mirror of
				https://github.com/vlang/v.git
				synced 2023-08-10 21:13:21 +03:00 
			
		
		
		
	flag help message is now a bit more compact
This commit is contained in:
		 radare
					radare
				
			
				
					committed by
					
						 Alexander Medvednikov
						Alexander Medvednikov
					
				
			
			
				
	
			
			
			 Alexander Medvednikov
						Alexander Medvednikov
					
				
			
						parent
						
							482f4c1b6c
						
					
				
				
					commit
					49430a5c31
				
			| @@ -416,8 +416,10 @@ pub fn (fs FlagParser) usage() string { | ||||
| 	if no_arguments { adesc = '' } | ||||
|  | ||||
| 	mut use := '' | ||||
| 	if fs.application_version != '' { | ||||
| 		use += '$fs.application_name $fs.application_version\n' | ||||
| 		use += '$UNDERLINE\n' | ||||
| 	} | ||||
| 	use += 'Usage: ${fs.application_name} [options] $adesc\n' | ||||
| 	use += '\n' | ||||
| 	if fs.application_description != '' { | ||||
| @@ -446,13 +448,22 @@ pub fn (fs FlagParser) usage() string { | ||||
| 	if fs.flags.len > 0 { | ||||
| 		use += 'Options:\n' | ||||
| 		for f in fs.flags { | ||||
| 			flag_desc := '  --$f.name $f.val_desc' | ||||
| 			longstr := if f.val_desc.contains('bool') { | ||||
| 				', --$f.name' | ||||
| 			} else { | ||||
| 				', --$f.name $f.val_desc' | ||||
| 			} | ||||
| 			flag_desc := if f.name.len == 0 { | ||||
| 				', $f.val_desc' | ||||
| 			} else { | ||||
| 				longstr | ||||
| 			} | ||||
| 			space := if flag_desc.len > SPACE.len-2 { | ||||
| 				'\n$SPACE' | ||||
| 			} else { | ||||
| 				SPACE[flag_desc.len..] | ||||
| 			} | ||||
| 			abbr_desc := if f.abbr == `\0` { '' } else { '  -${tos(f.abbr, 1)}\n' } | ||||
| 			abbr_desc := if f.abbr == `\0` { '' } else { '  -${tos(f.abbr, 1)}' } | ||||
| 			use += '${abbr_desc}${flag_desc}${space}${f.usage}\n' | ||||
| 		} | ||||
| 	} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user