From d8f76f3b2594db4687c0203c4f2be8d3e4ef7740 Mon Sep 17 00:00:00 2001 From: Ophestra Umiker Date: Wed, 4 Sep 2024 01:20:12 +0900 Subject: rename to fortify and restructure More sandbox features will be added and this will no longer track ego's features and behaviour. Signed-off-by: Ophestra Umiker --- cli.go | 41 +++++++---------------------------------- 1 file changed, 7 insertions(+), 34 deletions(-) (limited to 'cli.go') diff --git a/cli.go b/cli.go index ca1b41b6..e5466f0d 100644 --- a/cli.go +++ b/cli.go @@ -1,50 +1,23 @@ package main import ( - "errors" "flag" - "fmt" - "os" - "os/user" + + "git.ophivana.moe/cat/fortify/internal/system" ) var ( userName string - methodFlags [2]bool printVersion bool mustPulse bool + flagVerbose bool ) func init() { - flag.StringVar(&userName, "u", "ego", "Specify a username") - flag.BoolVar(&methodFlags[0], "sudo", false, "Use 'sudo' to change user") - flag.BoolVar(&methodFlags[1], "bare", false, "Use 'machinectl' but skip xdg-desktop-portal setup") + flag.StringVar(&userName, "u", "chronos", "Specify a username") + flag.BoolVar(&system.MethodFlags[0], "sudo", false, "Use 'sudo' to change user") + flag.BoolVar(&system.MethodFlags[1], "bare", false, "Use 'machinectl' but skip xdg-desktop-portal setup") flag.BoolVar(&mustPulse, "pulse", false, "Treat unavailable PulseAudio as fatal") - flag.BoolVar(&verbose, "v", false, "Verbose output") + flag.BoolVar(&flagVerbose, "v", false, "Verbose output") flag.BoolVar(&printVersion, "V", false, "Print version") } - -func copyArgs() { - tryLauncher() - tryVersion() - tryLicense() - - command = flag.Args() - - if u, err := user.Lookup(userName); err != nil { - if errors.As(err, new(user.UnknownUserError)) { - fmt.Println("unknown user", userName) - } else { - // unreachable - panic(err) - } - - os.Exit(1) - } else { - ego = u - } - - if verbose { - fmt.Println("Running as user", ego.Username, "("+ego.Uid+"),", "command:", command) - } -} -- cgit v1.3.1