diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-01-01 19:28:58 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-01-01 19:35:50 +0900 |
| commit | 35b714231768d11b82e575701ca5c7a081e2c542 (patch) | |
| tree | 2cb3550269f130c1643a5f07707ecf20d9c5ff5c /main.go | |
| parent | c4d6651cae0fb1869ee65da0b66baae3828d73a2 (diff) | |
fortify: show system info when instance is not specified
This contains useful information not obtainable by external tools.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 27 |
1 files changed, 11 insertions, 16 deletions
@@ -16,7 +16,6 @@ import ( "git.gensokyo.uk/security/fortify/internal/app" "git.gensokyo.uk/security/fortify/internal/fmsg" "git.gensokyo.uk/security/fortify/internal/linux" - "git.gensokyo.uk/security/fortify/internal/state" "git.gensokyo.uk/security/fortify/internal/system" ) @@ -128,24 +127,20 @@ func main() { // Ignore errors; set is set for ExitOnError. _ = set.Parse(args[1:]) - var ( - config *fst.Config - instance *state.State - name string - ) - - if len(set.Args()) != 1 { + switch len(set.Args()) { + case 0: // system + printShowSystem(short) + case 1: // instance + name := set.Args()[0] + config, instance := tryShort(name) + if config == nil { + config = tryPath(name) + } + printShowInstance(instance, config, short) + default: fmsg.Fatal("show requires 1 argument") - } else { - name = set.Args()[0] - config, instance = tryShort(name) - } - - if config == nil { - config = tryPath(name) } - printShow(instance, config, short) fmsg.Exit(0) case "app": // launch app from configuration file if len(args) < 2 { |
