aboutsummaryrefslogtreecommitdiff
path: root/v_windows/v/examples/v_script.vsh
diff options
context:
space:
mode:
authorIndrajith K L2022-12-03 17:00:20 +0530
committerIndrajith K L2022-12-03 17:00:20 +0530
commitf5c4671bfbad96bf346bd7e9a21fc4317b4959df (patch)
tree2764fc62da58f2ba8da7ed341643fc359873142f /v_windows/v/examples/v_script.vsh
downloadcli-tools-windows-master.tar.gz
cli-tools-windows-master.tar.bz2
cli-tools-windows-master.zip
Adds most of the toolsHEADmaster
Diffstat (limited to 'v_windows/v/examples/v_script.vsh')
-rw-r--r--v_windows/v/examples/v_script.vsh32
1 files changed, 32 insertions, 0 deletions
diff --git a/v_windows/v/examples/v_script.vsh b/v_windows/v/examples/v_script.vsh
new file mode 100644
index 0000000..1cdf910
--- /dev/null
+++ b/v_windows/v/examples/v_script.vsh
@@ -0,0 +1,32 @@
+#!/usr/local/bin/v run
+
+// The shebang above associates the file to V on Unix-like systems,
+// so it can be run just by specifying the path to the file
+// once it's made executable using `chmod +x`.
+
+for _ in 0 .. 3 {
+ println('V script')
+}
+
+println('\nMaking dir "v_script_dir".')
+mkdir('v_script_dir')
+
+println("\nEntering into v_script_dir and listing it's files.")
+chdir('v_script_dir')
+files := ls('.') or { panic(err.msg) }
+println(files)
+
+println('\nCreating foo.txt')
+create('foo.txt') ?
+
+println('\nFiles:')
+again_ls := ls('.') or { panic(err.msg) }
+println(again_ls)
+
+println('\nRemoving foo.txt and v_script_dir')
+rm('foo.txt')
+chdir('../')
+rmdir('v_script_dir')
+
+print('\nDoes v_script_dir still exist? ')
+println(exists('v_script_dir'))