swapped done args
This commit is contained in:
parent
c44a537e70
commit
05db15c62d
|
@ -37,8 +37,6 @@ func Parse(args []string, conf *configuration.Configuration) (Command, error) {
|
||||||
return NewTomorrow(conf)
|
return NewTomorrow(conf)
|
||||||
case "new":
|
case "new":
|
||||||
return NewNew(conf, cmdArgs)
|
return NewNew(conf, cmdArgs)
|
||||||
case "done":
|
|
||||||
return NewDone(conf, cmdArgs)
|
|
||||||
default:
|
default:
|
||||||
return NewEmpty()
|
return NewEmpty()
|
||||||
}
|
}
|
||||||
|
@ -49,5 +47,11 @@ func parseTaskCommand(id int, tArgs []string, conf *configuration.Configuration)
|
||||||
return NewShow(id, conf)
|
return NewShow(id, conf)
|
||||||
}
|
}
|
||||||
|
|
||||||
return NewEmpty()
|
cmd, _ := tArgs[0], tArgs[1:]
|
||||||
|
switch cmd {
|
||||||
|
case "done":
|
||||||
|
return NewDone(id, conf)
|
||||||
|
default:
|
||||||
|
return NewShow(id, conf)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ func TestCommand(t *testing.T) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "done",
|
name: "done",
|
||||||
args: []string{"done"},
|
args: []string{"123", "done"},
|
||||||
exp: "done",
|
exp: "done",
|
||||||
},
|
},
|
||||||
} {
|
} {
|
||||||
|
|
|
@ -17,7 +17,7 @@ type Done struct {
|
||||||
|
|
||||||
func (d *Done) Cmd() string { return "done" }
|
func (d *Done) Cmd() string { return "done" }
|
||||||
|
|
||||||
func NewDone(conf *configuration.Configuration, cmdArgs []string) (*Done, error) {
|
func NewDone(id int, conf *configuration.Configuration) (*Done, error) {
|
||||||
local, err := storage.NewSqlite(conf.Sqlite())
|
local, err := storage.NewSqlite(conf.Sqlite())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return &Done{}, err
|
return &Done{}, err
|
||||||
|
@ -30,9 +30,9 @@ func NewDone(conf *configuration.Configuration, cmdArgs []string) (*Done, error)
|
||||||
return &Done{}, err
|
return &Done{}, err
|
||||||
}
|
}
|
||||||
var tId string
|
var tId string
|
||||||
for id, localId := range localIds {
|
for remoteId, localId := range localIds {
|
||||||
if fmt.Sprintf("%d", localId) == cmdArgs[0] {
|
if localId == id {
|
||||||
tId = id
|
tId = remoteId
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue