mirror of
				https://github.com/optim-enterprises-bv/vault.git
				synced 2025-10-31 18:48:08 +00:00 
			
		
		
		
	Delegate usage to the UI
This commit is contained in:
		| @@ -313,17 +313,10 @@ type FlagSets struct { | ||||
| // NewFlagSets creates a new flag sets. | ||||
| func NewFlagSets(ui cli.Ui) *FlagSets { | ||||
| 	mainSet := flag.NewFlagSet("", flag.ContinueOnError) | ||||
| 	mainSet.Usage = func() {} | ||||
|  | ||||
| 	// Pull errors from the flagset into the ui's error | ||||
| 	errR, errW := io.Pipe() | ||||
| 	errScanner := bufio.NewScanner(errR) | ||||
| 	go func() { | ||||
| 		for errScanner.Scan() { | ||||
| 			ui.Error(errScanner.Text()) | ||||
| 		} | ||||
| 	}() | ||||
| 	mainSet.SetOutput(errW) | ||||
| 	// Errors and usage are controlled by the CLI. | ||||
| 	mainSet.Usage = func() {} | ||||
| 	mainSet.SetOutput(ioutil.Discard) | ||||
|  | ||||
| 	return &FlagSets{ | ||||
| 		flagSets:    make([]*FlagSet, 0, 6), | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Seth Vargo
					Seth Vargo