1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

tools: update v share to work with the playground redesign (#18090)

This commit is contained in:
Christopher Fore 2023-05-01 03:10:52 -04:00 committed by GitHub
parent e4e94acf15
commit b255fef686
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,12 @@ module main
import net.http import net.http
import os import os
import clipboard import clipboard
import json
struct Response {
hash string
error string
}
fn main() { fn main() {
mut cb := clipboard.new() mut cb := clipboard.new()
@ -32,7 +38,9 @@ fn main() {
share := http.post_form('https://play.vlang.io/share', { share := http.post_form('https://play.vlang.io/share', {
'code': content 'code': content
})! })!
url := 'https://play.vlang.io/p/${share.body}'
response := json.decode(Response, share.body)!
url := 'https://play.vlang.io/p/${response.hash}'
cb.copy(url) cb.copy(url)
println(url) println(url)