Skip to content

Commit

Permalink
bug fixes in parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Svihla committed Feb 24, 2021
1 parent 6a22111 commit aa59254
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cmd/db/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func CreateUsage() string {

// ExecuteCreate submits a new database to astra
func ExecuteCreate(args []string, client *astraops.AuthenticatedClient) error {
if err := createCmd.Parse(args[1:]); err != nil {
if err := createCmd.Parse(args); err != nil {
return &pkg.ParseError{
Args: args,
Err: err,
Expand Down
10 changes: 8 additions & 2 deletions cmd/db/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,19 @@ func ExecuteGet(args []string, client *astraops.AuthenticatedClient) error {
Err: fmt.Errorf("there is no id provided for parking the database"),
}
}

id := args[1]
if err := getCmd.Parse(args[1:]); err != nil {
return &pkg.ParseError{
Args: args,
Err: err,
}
}
id := args[0]
var db astraops.DataBase
var err error
if db, err = client.FindDb(id); err != nil {
return fmt.Errorf("unable to get '%s' with error %v\n", id, err)
}
fmt.Println(*getFmt)
switch *getFmt {
case "text":
var rows [][]string
Expand Down
2 changes: 1 addition & 1 deletion cmd/db/park.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func ExecutePark(args []string, client *astraops.AuthenticatedClient) error {
Err: fmt.Errorf("there is no id provided for parking the database"),
}
}
id := args[1]
id := args[0]
fmt.Printf("starting to park database %v\n", id)
if err := client.Park(id); err != nil {
return fmt.Errorf("unable to park '%s' with error %v\n", id, err)
Expand Down
2 changes: 1 addition & 1 deletion cmd/db/unpark.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func ExecuteUnpark(args []string, client *astraops.AuthenticatedClient) error {
Err: fmt.Errorf("there is no id provided for unparking the database"),
}
}
id := args[1]
id := args[0]
fmt.Printf("starting to unpark database %v\n", id)
if err := client.UnPark(id); err != nil {
return fmt.Errorf("unable to unpark '%s' with error %v\n", id, err)
Expand Down

0 comments on commit aa59254

Please sign in to comment.