diff --git a/Gopkg.lock b/Gopkg.lock index 21d93bfbb626db712ee56eaad41884fc34ac1ef8..fea2499b8c7e30b8209beb0307cc83677b098cc7 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -1,6 +1,12 @@ # This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. +[[projects]] + name = "github.com/cpuguy83/go-md2man" + packages = ["md2man"] + revision = "20f5889cbdc3c73dbd2862796665e7c465ade7d1" + version = "v1.0.8" + [[projects]] branch = "master" name = "github.com/dustin/go-humanize" @@ -73,6 +79,12 @@ revision = "b8543db493a5ed890c5499e935e2cad7504f3a04" version = "1.0.2" +[[projects]] + name = "github.com/russross/blackfriday" + packages = ["."] + revision = "55d61fa8aa702f59229e6cff85793c22e580eaf5" + version = "v1.5.1" + [[projects]] branch = "master" name = "github.com/shurcooL/httpfs" @@ -93,7 +105,10 @@ [[projects]] name = "github.com/spf13/cobra" - packages = ["."] + packages = [ + ".", + "doc" + ] revision = "ef82de70bb3f60c65fb8eebacbb2d122ef517385" version = "v0.0.3" @@ -109,9 +124,15 @@ packages = ["unix"] revision = "ac767d655b305d4e9612f5f6e33120b9176c4ad4" +[[projects]] + name = "gopkg.in/yaml.v2" + packages = ["."] + revision = "5420a8b6744d3b0345ab293f6fcba19c978f1183" + version = "v2.2.1" + [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "2c537a150e4bb29691ab6e3047366037abe663ebcc31c7e079f1e2f5ec40e5fa" + inputs-digest = "bbcfc01c18bb3703bea4b5d08a015a6bcc74f7ea2e9eb130c36e551745f2ec06" solver-name = "gps-cdcl" solver-version = 1 diff --git a/commands/close.go b/commands/close.go index 66c2b84d0fc48f54b53f1ab2fcb501f71de150b6..be0ff6e4247bacf74343e1838595cb7041592a12 100644 --- a/commands/close.go +++ b/commands/close.go @@ -44,5 +44,5 @@ var closeCmd = &cobra.Command{ } func init() { - rootCmd.AddCommand(closeCmd) + RootCmd.AddCommand(closeCmd) } diff --git a/commands/commands.go b/commands/commands.go index f06d1ce8769642abab31f4c9485194cc0a8b2051..0ab84717e2306a0466e9067d13e75cf0a09b01d1 100644 --- a/commands/commands.go +++ b/commands/commands.go @@ -47,7 +47,7 @@ var commandsCmd = &cobra.Command{ } func init() { - rootCmd.AddCommand(commandsCmd) + RootCmd.AddCommand(commandsCmd) commandsCmd.Flags().BoolVarP(&commandsDesc, "pretty", "p", false, "Output the command description as well as Markdown compatible comment", diff --git a/commands/comment.go b/commands/comment.go index ce40d2e323da3f1e864bad9d14accd35500eee88..cbd34ab36db501b02fca3a2b92bf09b385c85892 100644 --- a/commands/comment.go +++ b/commands/comment.go @@ -65,7 +65,7 @@ var commentCmd = &cobra.Command{ } func init() { - rootCmd.AddCommand(commentCmd) + RootCmd.AddCommand(commentCmd) commentCmd.Flags().StringVarP(&commentMessageFile, "file", "F", "", "Take the message from the given file. Use - to read the message from the standard input", diff --git a/commands/label.go b/commands/label.go index 07dabfe8e8cadbb217ea66fcfbe4c31992c2ba99..08d7a78a0d719aa1c11f8d1f7edfce7f5c3e0b81 100644 --- a/commands/label.go +++ b/commands/label.go @@ -99,7 +99,7 @@ var labelCmd = &cobra.Command{ } func init() { - rootCmd.AddCommand(labelCmd) + RootCmd.AddCommand(labelCmd) labelCmd.Flags().BoolVarP(&labelRemove, "remove", "r", false, "Remove a label", diff --git a/commands/ls.go b/commands/ls.go index fe3f9288e07bd70a29d7452ad759cb011df8c7e0..1bc2afff879b903b15894fb4cd1a9bcad2aec97a 100644 --- a/commands/ls.go +++ b/commands/ls.go @@ -53,5 +53,5 @@ var lsCmd = &cobra.Command{ } func init() { - rootCmd.AddCommand(lsCmd) + RootCmd.AddCommand(lsCmd) } diff --git a/commands/new.go b/commands/new.go index 63bd885cf4997021844d5f9d1d7112b573d9145b..9844e121da4db7139ed8a4c5c05b1f78ab9580c6 100644 --- a/commands/new.go +++ b/commands/new.go @@ -65,7 +65,7 @@ var newCmd = &cobra.Command{ } func init() { - rootCmd.AddCommand(newCmd) + RootCmd.AddCommand(newCmd) newCmd.Flags().StringVarP(&newMessageFile, "file", "F", "", "Take the message from the given file. Use - to read the message from the standard input", diff --git a/commands/open.go b/commands/open.go index 83e20a4a2c98e8b6615ff562369df323137c6198..6fe1e9d3aba4ce56c30ba57df62fba7adc8d0150 100644 --- a/commands/open.go +++ b/commands/open.go @@ -44,5 +44,5 @@ var openCmd = &cobra.Command{ } func init() { - rootCmd.AddCommand(openCmd) + RootCmd.AddCommand(openCmd) } diff --git a/commands/pull.go b/commands/pull.go index 6e8acf50b713f9441cd7912299a961ea698687da..83c2101a24d8ce87a58a334736c63a50d1847578 100644 --- a/commands/pull.go +++ b/commands/pull.go @@ -89,5 +89,5 @@ var pullCmd = &cobra.Command{ } func init() { - rootCmd.AddCommand(pullCmd) + RootCmd.AddCommand(pullCmd) } diff --git a/commands/push.go b/commands/push.go index 5965e89812393b515bacac8aa030b05d125ab774..37479bfdd6c84b443431ed6e37c205dbdc21f248 100644 --- a/commands/push.go +++ b/commands/push.go @@ -30,5 +30,5 @@ var pushCmd = &cobra.Command{ } func init() { - rootCmd.AddCommand(pushCmd) + RootCmd.AddCommand(pushCmd) } diff --git a/commands/root.go b/commands/root.go index 31aa6bad3c29cdb497c838e48016bb8d8c268045..7460601849b080fc5e2e4362caacd3543072ca15 100644 --- a/commands/root.go +++ b/commands/root.go @@ -10,14 +10,15 @@ import ( // Will display "git bug" // \u00A0 is a non-breaking space // It's used to avoid cobra to split the Use string at the first space to get the root command name -const rootCommandName = "git\u00A0bug" +//const rootCommandName = "git\u00A0bug" +const rootCommandName = "git-bug" const messageFilename = "BUG_MESSAGE_EDITMSG" // package scoped var to hold the repo after the PreRun execution var repo repository.Repo -// rootCmd represents the base command when called without any subcommands -var rootCmd = &cobra.Command{ +// RootCmd represents the base command when called without any subcommands +var RootCmd = &cobra.Command{ Use: rootCommandName, Short: "A bugtracker embedded in Git", Long: `git-bug is a bugtracker embedded in git. @@ -30,20 +31,18 @@ It use the same internal storage so it doesn't pollute your project. As you woul }, // Load the repo before any command execution - // Note, this concern only commands that actually has a Run function + // Note, this concern only commands that actually have a Run function PersistentPreRunE: loadRepo, } func Execute() { - if err := rootCmd.Execute(); err != nil { + if err := RootCmd.Execute(); err != nil { fmt.Println(err) os.Exit(1) } } func loadRepo(cmd *cobra.Command, args []string) error { - //fmt.Println("PersistentPreRun") - cwd, err := os.Getwd() if err != nil { return fmt.Errorf("Unable to get the current working directory: %q\n", err) diff --git a/commands/show.go b/commands/show.go index 8db3ed39012bf7bdb15a4b84ec4b2f4d4c7e62f1..9d330aabcff00fc028fe2d777af7e30036543bca 100644 --- a/commands/show.go +++ b/commands/show.go @@ -81,5 +81,5 @@ var showCmd = &cobra.Command{ } func init() { - rootCmd.AddCommand(showCmd) + RootCmd.AddCommand(showCmd) } diff --git a/commands/webui.go b/commands/webui.go index 0cabbc48ce86e3aba0850a118c3669dca18a08e7..eef15d2433a7c4552ca6f5caf81e505b8b073ab4 100644 --- a/commands/webui.go +++ b/commands/webui.go @@ -49,5 +49,5 @@ var webUICmd = &cobra.Command{ } func init() { - rootCmd.AddCommand(webUICmd) + RootCmd.AddCommand(webUICmd) } diff --git a/doc/gen_markdown.go b/doc/gen_markdown.go new file mode 100644 index 0000000000000000000000000000000000000000..ee87d54460438804820619c7e841e1f9ebf1367b --- /dev/null +++ b/doc/gen_markdown.go @@ -0,0 +1,24 @@ +// +build ignore + +package main + +import ( + "fmt" + "github.com/MichaelMure/git-bug/commands" + "github.com/spf13/cobra/doc" + "log" + "os" + "path" +) + +func main() { + cwd, _ := os.Getwd() + filepath := path.Join(cwd, "doc", "md") + + fmt.Println("Generating Markdown documentation ...") + + err := doc.GenMarkdownTree(commands.RootCmd, filepath) + if err != nil { + log.Fatal(err) + } +} diff --git a/doc/md/git-bug.md b/doc/md/git-bug.md new file mode 100644 index 0000000000000000000000000000000000000000..b6800a559aa550e13fda08370e8cce8681e30aa0 --- /dev/null +++ b/doc/md/git-bug.md @@ -0,0 +1,35 @@ +## git-bug + +A bugtracker embedded in Git + +### Synopsis + +git-bug is a bugtracker embedded in git. + +It use the same internal storage so it doesn't pollute your project. As you would do with commits and branches, you can push your bugs to the same git remote your are already using to collaborate with other peoples. + +``` +git-bug [flags] +``` + +### Options + +``` + -h, --help help for git-bug +``` + +### SEE ALSO + +* [git-bug close](git-bug_close.md) - Mark the bug as closed +* [git-bug commands](git-bug_commands.md) - Display available commands +* [git-bug comment](git-bug_comment.md) - Add a new comment to a bug +* [git-bug label](git-bug_label.md) - Manipulate bug's label +* [git-bug ls](git-bug_ls.md) - Display a summary of all bugs +* [git-bug new](git-bug_new.md) - Create a new bug +* [git-bug open](git-bug_open.md) - Mark the bug as open +* [git-bug pull](git-bug_pull.md) - Pull bugs update from a git remote +* [git-bug push](git-bug_push.md) - Push bugs update to a git remote +* [git-bug show](git-bug_show.md) - Display the details of a bug +* [git-bug webui](git-bug_webui.md) - Launch the web UI + +###### Auto generated by spf13/cobra on 20-Jul-2018 diff --git a/doc/md/git-bug_close.md b/doc/md/git-bug_close.md new file mode 100644 index 0000000000000000000000000000000000000000..89aa22c7f5663da4b315eaa1296806684b784354 --- /dev/null +++ b/doc/md/git-bug_close.md @@ -0,0 +1,23 @@ +## git-bug close + +Mark the bug as closed + +### Synopsis + +Mark the bug as closed + +``` +git-bug close [flags] +``` + +### Options + +``` + -h, --help help for close +``` + +### SEE ALSO + +* [git-bug](git-bug.md) - A bugtracker embedded in Git + +###### Auto generated by spf13/cobra on 20-Jul-2018 diff --git a/doc/md/git-bug_commands.md b/doc/md/git-bug_commands.md new file mode 100644 index 0000000000000000000000000000000000000000..83a03b79b936d6c689f3602e522ebaf5e7767cf8 --- /dev/null +++ b/doc/md/git-bug_commands.md @@ -0,0 +1,24 @@ +## git-bug commands + +Display available commands + +### Synopsis + +Display available commands + +``` +git-bug commands [