vcreate: minor tweaks (#9275)
							parent
							
								
									603012be94
								
							
						
					
					
						commit
						e09a8a47b0
					
				| 
						 | 
					@ -1,8 +1,7 @@
 | 
				
			||||||
module main
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Copyright (c) 2019-2021 Alexander Medvednikov. All rights reserved.
 | 
					// Copyright (c) 2019-2021 Alexander Medvednikov. All rights reserved.
 | 
				
			||||||
// Use of this source code is governed by an MIT license that can be found in the LICENSE file.
 | 
					// Use of this source code is governed by an MIT license that can be found in the LICENSE file.
 | 
				
			||||||
//
 | 
					module main
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// This module follows a similar convention to Rust: `init` makes the
 | 
					// This module follows a similar convention to Rust: `init` makes the
 | 
				
			||||||
// structure of the program in the _current_ directory, while `new`
 | 
					// structure of the program in the _current_ directory, while `new`
 | 
				
			||||||
// makes the program structure in a _sub_ directory. Besides that, the
 | 
					// makes the program structure in a _sub_ directory. Besides that, the
 | 
				
			||||||
| 
						 | 
					@ -22,6 +21,14 @@ fn cerror(e string) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fn check_name(name string) string {
 | 
					fn check_name(name string) string {
 | 
				
			||||||
 | 
						if name.is_title() {
 | 
				
			||||||
 | 
							mut cname := name.to_lower()
 | 
				
			||||||
 | 
							if cname.contains(' ') {
 | 
				
			||||||
 | 
								cname = cname.replace(' ', '_')
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							eprintln('warning: the project name cannot be capitalized, the name will be changed to `$cname`')
 | 
				
			||||||
 | 
							return cname
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	if name.contains(' ') {
 | 
						if name.contains(' ') {
 | 
				
			||||||
		cname := name.replace(' ', '_')
 | 
							cname := name.replace(' ', '_')
 | 
				
			||||||
		eprintln('warning: the project name cannot contain spaces, the name will be changed to `$cname`')
 | 
							eprintln('warning: the project name cannot contain spaces, the name will be changed to `$cname`')
 | 
				
			||||||
| 
						 | 
					@ -154,13 +161,18 @@ fn init_project() {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fn main() {
 | 
					fn main() {
 | 
				
			||||||
	if os.args[1] == 'new' {
 | 
						cmd := os.args[1]
 | 
				
			||||||
 | 
						match cmd {
 | 
				
			||||||
 | 
							'new' {
 | 
				
			||||||
			create(os.args[2..])
 | 
								create(os.args[2..])
 | 
				
			||||||
	} else if os.args[1] == 'init' {
 | 
							}
 | 
				
			||||||
 | 
							'init' {
 | 
				
			||||||
			init_project()
 | 
								init_project()
 | 
				
			||||||
	} else {
 | 
							}
 | 
				
			||||||
		cerror('Unknown command: ${os.args[1]}')
 | 
							else {
 | 
				
			||||||
 | 
								cerror('unknown command: $cmd')
 | 
				
			||||||
			exit(1)
 | 
								exit(1)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	println('Complete!')
 | 
						println('Complete!')
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -49,4 +49,4 @@ Use "v help <command>" for more information about a command, example: `v help bu
 | 
				
			||||||
Use "v help other" to see less frequently used commands.
 | 
					Use "v help other" to see less frequently used commands.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Note: Help is required to write more help topics.
 | 
					Note: Help is required to write more help topics.
 | 
				
			||||||
Only build, doc, fmt, run, test, search, install, remove, update, bin2v, check-md are properly documented currently.
 | 
					Only build, new, init, doc, fmt, run, test, search, install, remove, update, bin2v, check-md are properly documented currently.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,4 @@
 | 
				
			||||||
 | 
					Usage:
 | 
				
			||||||
 | 
					  v init
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Setup the file structure for an already existing V project.
 | 
				
			||||||
		Loading…
	
		Reference in New Issue