Documentation
¶
Index ¶
- Constants
- Variables
- func DeleteCmd(c client.ClientInterface) *cobra.Command
- func Execute()
- func InsertCmd(c client.ClientInterface) *cobra.Command
- func LoginCmd(c client.ClientInterface) *cobra.Command
- func ReadCmd(c client.ClientInterface) *cobra.Command
- func UpdateCmd(c client.ClientInterface) *cobra.Command
Constants ¶
View Source
const Version string = "v1.0.3"
Variables ¶
View Source
var RootCmd = &cobra.Command{ Use: "kayveedb-cli", Short: "CLI to interact with KayveeDB server", PersistentPreRun: func(cmd *cobra.Command, args []string) { dsn := os.Getenv("DB_DSN") if dsn != "" { parseDSN(dsn) } else { username = getEnvOrDefault("USERNAME", username) password = getEnvOrDefault("PASSWORD", password) database = getEnvOrDefault("DB_NAME", database) hostname = getEnvOrDefault("DB_HOST", hostname) port = getEnvOrDefault("DB_PORT", port) if username == "" { fmt.Print("username: ") fmt.Scanln(&username) } if database == "" { fmt.Print("database: ") fmt.Scanln(&database) } if password == "" { fmt.Printf("%s's password: ", username) bytePassword, err := term.ReadPassword(0) if err != nil { log.Fatal("Failed to read password") } password = string(bytePassword) fmt.Println() } } realClient := client.NewClient() err := realClient.Authenticate(username, password, database, hostname, port) if err != nil { log.Fatalf("Failed to login: %v", err) } }, }
RootCmd is the base command for the CLI.
Functions ¶
Types ¶
This section is empty.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.