mirror of
https://github.com/xaionaro-go/streamctl.git
synced 2025-10-13 11:13:50 +08:00
Initial commit, pt. 63
This commit is contained in:
@@ -75,6 +75,16 @@ var (
|
||||
Run: variablesSet,
|
||||
}
|
||||
|
||||
Config = &cobra.Command{
|
||||
Use: "config",
|
||||
}
|
||||
|
||||
ConfigGet = &cobra.Command{
|
||||
Use: "get",
|
||||
Args: cobra.ExactArgs(0),
|
||||
Run: configGet,
|
||||
}
|
||||
|
||||
LoggerLevel = logger.LevelWarning
|
||||
)
|
||||
|
||||
@@ -88,6 +98,9 @@ func init() {
|
||||
Variables.AddCommand(VariablesGetHash)
|
||||
Variables.AddCommand(VariablesSet)
|
||||
|
||||
Root.AddCommand(Config)
|
||||
Config.AddCommand(ConfigGet)
|
||||
|
||||
Root.PersistentFlags().Var(&LoggerLevel, "log-level", "")
|
||||
Root.PersistentFlags().String("remote-addr", "localhost:3594", "the path to the config file")
|
||||
StreamSetup.PersistentFlags().String("title", "", "stream title")
|
||||
@@ -212,3 +225,16 @@ func variablesSet(cmd *cobra.Command, args []string) {
|
||||
err = streamD.SetVariable(ctx, consts.VarKey(variableKey), value)
|
||||
assertNoError(ctx, err)
|
||||
}
|
||||
|
||||
func configGet(cmd *cobra.Command, args []string) {
|
||||
ctx := cmd.Context()
|
||||
|
||||
remoteAddr, err := cmd.Flags().GetString("remote-addr")
|
||||
assertNoError(ctx, err)
|
||||
streamD := client.New(remoteAddr)
|
||||
|
||||
cfg, err := streamD.GetConfig(ctx)
|
||||
assertNoError(ctx, err)
|
||||
|
||||
cfg.WriteTo(os.Stdout)
|
||||
}
|
||||
|
Reference in New Issue
Block a user