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:
parent
e4e94acf15
commit
b255fef686
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user