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

docs: fix the .vsh doc example (#13645)

This commit is contained in:
Devin Bayer 2022-03-03 18:47:05 +01:00 committed by GitHub
parent 4331d6dea0
commit 9cc73fd0f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5777,6 +5777,12 @@ An example `deploy.vsh`:
// so it can be run just by specifying the path to the file
// once it's made executable using `chmod +x`.
// print command then execute it
fn sh(cmd string){
println(" $cmd")
print(execute_or_exit(cmd).output)
}
// Remove if build/ exits, ignore any errors if it doesn't
rmdir_all('build') or { }
@ -5784,17 +5790,11 @@ rmdir_all('build') or { }
mkdir('build') ?
// Move *.v files to build/
result := execute('mv *.v build/') ?
result := execute('mv *.v build/')
if result.exit_code != 0 {
println(result.output)
}
// print command then execute it
fn sh(cmd string){
println(" $cmd")
print(execute_or_exit(cmd).output)
}
sh('ls')
// Similar to: