-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This command is handy to retrieve the schema used on the device. This provides the information about the available parameters and the minimum and maximum value ranges. As well as their defaults. Signed-off-by: Christian Ege <[email protected]>
- Loading branch information
Showing
2 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
Copyright © 2023 Christian Ege <[email protected]> | ||
*/ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/graugans/go-ovp8xx/pkg/ovp8xx" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func getSchemaCommand(cmd *cobra.Command, args []string) error { | ||
|
||
host, err := rootCmd.PersistentFlags().GetString("ip") | ||
if err != nil { | ||
return err | ||
} | ||
|
||
o3r := ovp8xx.NewClient( | ||
ovp8xx.WithHost(host), | ||
) | ||
|
||
if result, err := o3r.GetSchema(); err != nil { | ||
return err | ||
} else { | ||
fmt.Printf("%s\n", result) | ||
} | ||
return nil | ||
} | ||
|
||
// getCmd represents the get command | ||
var getSchemaCmd = &cobra.Command{ | ||
Use: "getSchema", | ||
Short: "Retrieve the currently used JSON schema from the device", | ||
RunE: getSchemaCommand, | ||
} | ||
|
||
func init() { | ||
rootCmd.AddCommand(getSchemaCmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters