MCPcopy Create free account
hub / github.com/JKme/cube / init

Function init

cli/cmd/sqlcmd.go:62–95  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

60}
61
62func init() {
63 sqlCli = &cobra.Command{
64 Use: "sqlcmd",
65 Short: "exec sql or cmd",
66 Long: sqlcmdmodule.SqlcmdHelpTable(),
67 Run: runSqlcmd,
68 Example: `cube sqlcmd -x mysql -l root -p root -e "whoami"
69cube sqlcmd -x mysql -l root -p root -e "clear"
70cube sqlcmd -x mssql -l sa -p sa -e "whoami" --port 4134
71 `,
72 }
73
74 sqlCli.Flags().StringP("service", "s", "", "service ip")
75 sqlCli.Flags().StringP("login", "l", "", "login user")
76 sqlCli.Flags().StringP("password", "p", "", "login password")
77 sqlCli.Flags().StringP("query", "e", "", "string to query or exec")
78 sqlCli.Flags().StringP("plugin", "x", "", fmt.Sprintf("avaliable plugin: %s", 111))
79 sqlCli.Flags().StringP("port", "", "", "if the service is on a different default port, define it here")
80
81 if err := sqlCli.MarkFlagRequired("plugin"); err != nil {
82 gologger.Errorf("error on marking flag as required: %v", err)
83 }
84 if err := sqlCli.MarkFlagRequired("service"); err != nil {
85 gologger.Errorf("error on marking flag as required: %v", err)
86 }
87 if err := sqlCli.MarkFlagRequired("login"); err != nil {
88 gologger.Errorf("error on marking flag as required: %v", err)
89 }
90 if err := sqlCli.MarkFlagRequired("password"); err != nil {
91 gologger.Errorf("error on marking flag as required: %v", err)
92 }
93
94 rootCmd.AddCommand(sqlCli)
95}

Callers

nothing calls this directly

Calls 2

SqlcmdHelpTableFunction · 0.92
ErrorfFunction · 0.92

Tested by

no test coverage detected