-
-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The GitLab WebUI allows users to mark Todo list items as "Done". Add a "done" command that allows users to mark Todo list items as "Done." Signed-off-by: Prarit Bhargava <[email protected]>
- Loading branch information
Showing
3 changed files
with
41 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
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,29 @@ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
"strconv" | ||
|
||
"github.com/spf13/cobra" | ||
lab "github.com/zaquestion/lab/internal/gitlab" | ||
) | ||
|
||
var todoDoneCmd = &cobra.Command{ | ||
Use: "done", | ||
Short: "Mark todo list entry as Done", | ||
Long: ``, | ||
PersistentPreRun: LabPersistentPreRun, | ||
Run: func(cmd *cobra.Command, args []string) { | ||
toDoNum, err := strconv.Atoi(args[0]) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
lab.TodoMarkDone(toDoNum) | ||
fmt.Println(toDoNum, "marked as Done") | ||
}, | ||
} | ||
|
||
func init() { | ||
todoCmd.AddCommand(todoDoneCmd) | ||
} |
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