mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
all: require calling optfn() ?
/ optfn() or {...}
for fn optfn() ? {}
This commit is contained in:
@ -58,7 +58,7 @@ fn (c &Create) write_vmod(new bool) {
|
||||
cerror(err)
|
||||
exit(1)
|
||||
}
|
||||
vmod.write_str(vmod_content(c.name, c.description))
|
||||
vmod.write_str(vmod_content(c.name, c.description)) or { panic(err) }
|
||||
vmod.close()
|
||||
}
|
||||
|
||||
@ -67,12 +67,12 @@ fn (c &Create) write_main(new bool) {
|
||||
return
|
||||
}
|
||||
main_path := if new { '$c.name/${c.name}.v' } else { '${c.name}.v' }
|
||||
mut main := os.create(main_path) or {
|
||||
mut mainfile := os.create(main_path) or {
|
||||
cerror(err)
|
||||
exit(2)
|
||||
}
|
||||
main.write_str(main_content())
|
||||
main.close()
|
||||
mainfile.write_str(main_content()) or { panic(err) }
|
||||
mainfile.close()
|
||||
}
|
||||
|
||||
fn (c &Create) create_git_repo(dir string) {
|
||||
@ -87,7 +87,7 @@ fn (c &Create) create_git_repo(dir string) {
|
||||
// We don't really need a .gitignore, it's just a nice-to-have
|
||||
return
|
||||
}
|
||||
fl.write_str(gen_gitignore(c.name))
|
||||
fl.write_str(gen_gitignore(c.name)) or { panic(err) }
|
||||
fl.close()
|
||||
}
|
||||
}
|
||||
@ -110,9 +110,7 @@ fn create() {
|
||||
}
|
||||
c.description = os.input('Input your project description: ')
|
||||
println('Initialising ...')
|
||||
os.mkdir(c.name) or {
|
||||
panic(err)
|
||||
}
|
||||
os.mkdir(c.name) or { panic(err) }
|
||||
c.write_vmod(true)
|
||||
c.write_main(true)
|
||||
c.create_git_repo(c.name)
|
||||
|
Reference in New Issue
Block a user