Compare commits
1 Commits
feat/timeo
...
feat/demo
| Author | SHA1 | Date | |
|---|---|---|---|
| 92be4f65b0 |
@ -1,3 +1,6 @@
|
||||
# unifood
|
||||
|
||||
University restaurant CLI that allows to retrieve menu information
|
||||
University restaurant CLI that allows to retrieve menu information
|
||||
|
||||
## Demo
|
||||

|
||||
@ -1,11 +1,8 @@
|
||||
package cmd
|
||||
|
||||
const DefaultRequestTimeout uint = 30
|
||||
|
||||
type AppConfig struct {
|
||||
OutputVerbose bool
|
||||
OutputFormatter string
|
||||
OutputOrderReverse bool
|
||||
PrintConfig bool
|
||||
RequestTimeoutSeconds uint
|
||||
OutputVerbose bool
|
||||
OutputFormatter string
|
||||
OutputOrderReverse bool
|
||||
PrintConfig bool
|
||||
}
|
||||
|
||||
@ -34,7 +34,6 @@ func initRootCmd() {
|
||||
rootCmd.PersistentFlags().StringVarP(&appConfig.OutputFormatter, "output", "o", "table", "Set output format")
|
||||
rootCmd.PersistentFlags().BoolVar(&appConfig.OutputOrderReverse, "reverse", false, "Reverses output item order")
|
||||
rootCmd.PersistentFlags().BoolVar(&appConfig.PrintConfig, "print-config", false, "Enable printing the application config")
|
||||
rootCmd.PersistentFlags().UintVar(&appConfig.RequestTimeoutSeconds, "timeout", DefaultRequestTimeout, "Set the request timeout in seconds")
|
||||
|
||||
logger := jlog.New(slog.LevelDebug)
|
||||
ctx := jlog.ContextWith(context.Background(), logger)
|
||||
|
||||
@ -8,7 +8,6 @@ import (
|
||||
"os"
|
||||
"slices"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.bissendorf.co/bissendorf/unifood/m/v2/core/interfaces"
|
||||
"git.bissendorf.co/bissendorf/unifood/m/v2/core/interfaces/params"
|
||||
@ -93,8 +92,6 @@ func getVerbs(ctx context.Context, config *AppConfig) (commands []*cobra.Command
|
||||
}
|
||||
logger := jlog.New(logLevel)
|
||||
ctx := jlog.ContextWith(context.Background(), logger)
|
||||
ctx, cancel := context.WithTimeout(ctx, time.Duration(config.RequestTimeoutSeconds)*time.Second)
|
||||
defer cancel()
|
||||
|
||||
// Print config
|
||||
if config.PrintConfig {
|
||||
|
||||
BIN
docs/res/demo.mp4
Normal file
BIN
docs/res/demo.mp4
Normal file
Binary file not shown.
Reference in New Issue
Block a user