mirror of
https://github.com/Luzifer/ots.git
synced 2025-07-22 06:08:51 -04:00
Implement OTS-CLI utility (#117)
This commit is contained in:
parent
c5124731f5
commit
546481dcfc
20 changed files with 861 additions and 70 deletions
32
cmd/ots-cli/cmd_root.go
Normal file
32
cmd/ots-cli/cmd_root.go
Normal file
|
@ -0,0 +1,32 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var rootCmd = &cobra.Command{
|
||||
Short: "Utility to interact with encrypted secrets in an OTS instance",
|
||||
PersistentPreRunE: rootPersistentPreRunE,
|
||||
}
|
||||
|
||||
func init() {
|
||||
rootCmd.PersistentFlags().String("log-level", "info", "Level to use for logging (trace, debug, info, warn, error, fatal)")
|
||||
}
|
||||
|
||||
func rootPersistentPreRunE(cmd *cobra.Command, _ []string) error {
|
||||
sll, err := cmd.Flags().GetString("log-level")
|
||||
if err != nil {
|
||||
return fmt.Errorf("getting log-level: %w", err)
|
||||
}
|
||||
|
||||
ll, err := logrus.ParseLevel(sll)
|
||||
if err != nil {
|
||||
return fmt.Errorf("parsing log-level: %w", err)
|
||||
}
|
||||
logrus.SetLevel(ll)
|
||||
|
||||
return nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue