mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
v.mod: remove commas; add example for v.vmod (#6169)
This commit is contained in:
parent
88bca9d17a
commit
eabc2daf86
@ -7,7 +7,6 @@ module main
|
||||
// structure of the program in the _current_ directory, while `new`
|
||||
// makes the program structure in a _sub_ directory. Besides that, the
|
||||
// functionality is essentially the same.
|
||||
|
||||
import os
|
||||
|
||||
struct Create {
|
||||
@ -23,11 +22,11 @@ fn cerror(e string) {
|
||||
fn vmod_content(name, desc string) string {
|
||||
return [
|
||||
'Module {',
|
||||
" name: '$name',",
|
||||
" description: '$desc',",
|
||||
" version: '0.0.0',",
|
||||
" name: '$name'",
|
||||
" description: '$desc'",
|
||||
" version: '0.0.0'",
|
||||
' dependencies: []',
|
||||
'}'
|
||||
'}',
|
||||
].join('\n')
|
||||
}
|
||||
|
||||
@ -36,7 +35,7 @@ fn main_content() string {
|
||||
'module main\n',
|
||||
'fn main() {',
|
||||
" println('Hello World!')",
|
||||
'}'
|
||||
'}',
|
||||
].join('\n')
|
||||
}
|
||||
|
||||
@ -46,7 +45,7 @@ fn gen_gitignore(name string) string {
|
||||
'$name',
|
||||
'*.so',
|
||||
'*.dylib',
|
||||
'*.dll'
|
||||
'*.dll',
|
||||
].join('\n')
|
||||
}
|
||||
|
||||
|
11
examples/vmod.v
Normal file
11
examples/vmod.v
Normal file
@ -0,0 +1,11 @@
|
||||
module main
|
||||
|
||||
import v.vmod
|
||||
|
||||
fn main() {
|
||||
mod := vmod.decode(@VMOD_FILE) or {
|
||||
panic('Error decoding v.mod')
|
||||
}
|
||||
println('$mod.name has version $mod.version')
|
||||
println('\nThe full mod struct: \n$mod')
|
||||
}
|
Loading…
Reference in New Issue
Block a user