Skip to content

Instantly share code, notes, and snippets.

@Esl1h
Last active April 5, 2025 22:31
Show Gist options
  • Save Esl1h/ae057bc1caa1fe6ede8b81452b60cf54 to your computer and use it in GitHub Desktop.
Save Esl1h/ae057bc1caa1fe6ede8b81452b60cf54 to your computer and use it in GitHub Desktop.
deploy.vsh
#!/usr/bin/env -S v
// A linha cima associa pelo env o .vsh ao V
// Então basta dar permissão de execução (+x) executar o script .vsh no terminal
// como `./deploy.vsh`
// 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 {}
// Create build/, never fails as build/ does not exist
mkdir('build')!
// Move *.v files to build/
result := execute('mv *.v build/')
if result.exit_code != 0 {
println(result.output)
}
sh('ls')
// Similar to:
// files := ls('.')!
// mut count := 0
// if files.len > 0 {
// for file in files {
// if file.ends_with('.v') {
// mv(file, 'build/') or {
// println('err: ${err}')
// return
// }
// }
// count++
// }
// }
// if count == 0 {
// println('No files')
// }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment