Add --version flag
This commit is contained in:
		
							
								
								
									
										9
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								main.go
									
									
									
									
									
								
							@@ -18,6 +18,7 @@ package main
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
	"errors"
 | 
						"errors"
 | 
				
			||||||
 | 
						"flag"
 | 
				
			||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
	"os"
 | 
						"os"
 | 
				
			||||||
	"path/filepath"
 | 
						"path/filepath"
 | 
				
			||||||
@@ -74,6 +75,14 @@ func main() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	gmx := NewGomuks(MainUIProvider, configDir, dataDir, cacheDir, downloadDir)
 | 
						gmx := NewGomuks(MainUIProvider, configDir, dataDir, cacheDir, downloadDir)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						isVersion := flag.Bool("version", false, "Display gomuks version and exit")
 | 
				
			||||||
 | 
						flag.Parse()
 | 
				
			||||||
 | 
						if *isVersion {
 | 
				
			||||||
 | 
							fmt.Printf("gomuks version %s\n", gmx.Version())
 | 
				
			||||||
 | 
							os.Exit(0)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	gmx.Start()
 | 
						gmx.Start()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// We use os.Exit() everywhere, so exiting by returning from Start() shouldn't happen.
 | 
						// We use os.Exit() everywhere, so exiting by returning from Start() shouldn't happen.
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user