Updated -help flag (fixed test)

main
lcomrade 11 months ago
parent 85ee6d0968
commit 75b0de7c64
  1. 4
      cmd/horizon.go
  2. 18
      internal/settings/settings.go
  3. 4
      internal/settings/settings_test.go

@ -60,7 +60,7 @@ func GetPathToResource(fileName string) string {
return path
}
return filepath.Join(*settings.ArgDir, fileName)
return filepath.Join(settings.ArgDir, fileName)
}
func IsHide(fileName string) bool {
@ -206,7 +206,7 @@ func main() {
logger.SetLevel(settings.Config.Logging.Level)
//Console setup
if *settings.ArgNoColors != true {
if settings.ArgNoColors != true {
logger.UseColors()
}

@ -77,8 +77,8 @@ var ConfigDefault = ConfigType{
//Get the path to the file. Can return an empty string.
func GetFilePath(fileName string) string {
if *ArgConfigDir != "" {
path := filepath.Join(*ArgConfigDir, fileName)
if ArgConfigDir != "" {
path := filepath.Join(ArgConfigDir, fileName)
_, err := os.Stat(path)
if err == nil {
@ -185,9 +185,9 @@ func PrintHelp() {
}
//Global vars
var ArgDir *string
var ArgConfigDir *string
var ArgNoColors *bool
var ArgDir string
var ArgConfigDir string
var ArgNoColors bool
var Config ConfigType
var HtmlTemplate *template.Template
var ResourcesDir string
@ -200,10 +200,10 @@ func Main() {
flagSet := flag.NewFlagSet(build.Name, flag.ContinueOnError)
flagSet.SetOutput(ioutil.Discard)
ArgDir = flagSet.String("dir", ".", locale.Dir_flag)
ArgConfigDir = flagSet.String("config-dir", "", locale.Config_dir_flag)
ArgDir = *flagSet.String("dir", ".", locale.Dir_flag)
ArgConfigDir = *flagSet.String("config-dir", "", locale.Config_dir_flag)
argListen := flagSet.String("listen", "", locale.Listen_flag)
ArgNoColors = flagSet.Bool("no-colors", false, locale.No_colors_flag)
ArgNoColors = *flagSet.Bool("no-colors", false, locale.No_colors_flag)
argInfo := flagSet.Bool("info", false, locale.Info_flag)
argVersion := flagSet.Bool("version", false, locale.Version_flag)
argHelp := flagSet.Bool("help", false, locale.Help_flag)
@ -217,7 +217,7 @@ func Main() {
}
//Console setup
if *ArgNoColors != true {
if ArgNoColors != true {
logger.UseColors()
}

@ -17,7 +17,9 @@ var mainRun = false
func MakeMain() {
if mainRun == false {
Main()
//Main()
ArgConfigDir = ""
mainRun = true
}
}

Loading…
Cancel
Save