From 40d0550ad3f450ce8bb597b851a2db9721b7d6f6 Mon Sep 17 00:00:00 2001 From: Ophestra Umiker Date: Fri, 13 Sep 2024 11:49:10 +0900 Subject: [PATCH] flag: move method flag from main Signed-off-by: Ophestra Umiker --- flag.go | 11 +++++++++++ main.go | 10 ---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/flag.go b/flag.go index aa67908..f69f8f3 100644 --- a/flag.go +++ b/flag.go @@ -2,6 +2,8 @@ package main import ( "flag" + + "git.ophivana.moe/cat/fortify/internal/util" ) var ( @@ -39,3 +41,12 @@ func init() { flag.BoolVar(&flagVerbose, "v", false, "Verbose output") flag.BoolVar(&printVersion, "V", false, "Print version") } + +func init() { + methodHelpString := "Method of launching the child process, can be one of \"sudo\", \"bubblewrap\"" + if util.SdBootedV { + methodHelpString += ", \"systemd\"" + } + + flag.StringVar(&launchOptionText, "method", "sudo", methodHelpString) +} diff --git a/main.go b/main.go index 85ac5a8..ebd5970 100644 --- a/main.go +++ b/main.go @@ -16,7 +16,6 @@ import ( "git.ophivana.moe/cat/fortify/internal/app" "git.ophivana.moe/cat/fortify/internal/state" "git.ophivana.moe/cat/fortify/internal/system" - "git.ophivana.moe/cat/fortify/internal/util" "git.ophivana.moe/cat/fortify/internal/verbose" ) @@ -31,15 +30,6 @@ var ( launchOptionText string ) -func init() { - methodHelpString := "Method of launching the child process, can be one of \"sudo\", \"bubblewrap\"" - if util.SdBootedV { - methodHelpString += ", \"systemd\"" - } - - flag.StringVar(&launchOptionText, "method", "sudo", methodHelpString) -} - func tryVersion() { if printVersion { fmt.Println(Version)