mirror of
https://github.com/davidallendj/magellan.git
synced 2025-12-20 03:27:03 -07:00
Add support for storage command and crawler output
Partially addresses issue #3 by adding a simple `magellan list devices` command to list storage devices. To close the issue, this PR still requires including storage device information in the `crawler`'s output. Reviewed-on: towk/magellan-ng#5
This commit is contained in:
parent
461c006d75
commit
2596e8945f
5 changed files with 77 additions and 1 deletions
17
pkg/list.go
17
pkg/list.go
|
|
@ -23,7 +23,22 @@ func PrintRemoteAssets(data []RemoteAsset, format string) {
|
|||
fmt.Printf("%s:%d (%s) @%s\n", r.Host, r.Port, r.Protocol, r.Timestamp.Format(time.UnixDate))
|
||||
}
|
||||
default:
|
||||
log.Error().Msg("PrintRemoteAssets: unrecognized format")
|
||||
log.Error().Msg("unrecognized format")
|
||||
}
|
||||
}
|
||||
|
||||
func PrintMapFormat(data map[string]any, format string) {
|
||||
switch strings.ToLower(format) {
|
||||
case "json":
|
||||
util.PrintJSON(data)
|
||||
case "yaml":
|
||||
util.PrintYAML(data)
|
||||
case "none":
|
||||
for k, v := range data {
|
||||
fmt.Printf("%s: %v\n", k, v)
|
||||
}
|
||||
default:
|
||||
log.Error().Msg("unrecognized format")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue