aboutsummaryrefslogtreecommitdiff
path: root/v_windows/v/examples/v_script.vsh
blob: 1cdf910bf67e4fdc4cd854031821a1794313c5b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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'))