diff --git a/README.md b/README.md index 4d2c28a..29a2191 100644 --- a/README.md +++ b/README.md @@ -39,17 +39,17 @@ Usage: shiori [command] Available Commands: - account Manage account for accessing web interface. - add Bookmark the specified URL. - delete Delete the saved bookmarks. - export Export bookmarks into HTML file in Netscape Bookmark format. + account Manage account for accessing web interface + add Bookmark the specified URL + delete Delete the saved bookmarks + export Export bookmarks into HTML file in Netscape Bookmark format help Help about any command - import Import bookmarks from HTML file in Netscape Bookmark format. - open Open the saved bookmarks. - print Print the saved bookmarks. - search Search bookmarks by submitted keyword. - serve Serve web app for managing bookmarks. - update Update the saved bookmarks. + import Import bookmarks from HTML file in Netscape Bookmark format + open Open the saved bookmarks + print Print the saved bookmarks + search Search bookmarks by submitted keyword + serve Serve web app for managing bookmarks + update Update the saved bookmarks Flags: -h, --help help for shiori diff --git a/cmd/account.go b/cmd/account.go index fafb6f3..08a9aea 100644 --- a/cmd/account.go +++ b/cmd/account.go @@ -2,20 +2,21 @@ package cmd import ( "fmt" + "syscall" + "github.com/spf13/cobra" "golang.org/x/crypto/ssh/terminal" - "syscall" ) var ( accountCmd = &cobra.Command{ Use: "account", - Short: "Manage account for accessing web interface.", + Short: "Manage account for accessing web interface", } addAccountCmd = &cobra.Command{ Use: "add username", - Short: "Create new account.", + Short: "Create new account", Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { username := args[0] @@ -40,7 +41,7 @@ var ( printAccountCmd = &cobra.Command{ Use: "print", - Short: "Print the saved accounts.", + Short: "Print the saved accounts", Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { keyword, _ := cmd.Flags().GetString("search") @@ -54,7 +55,7 @@ var ( deleteAccountCmd = &cobra.Command{ Use: "delete [usernames]", - Short: "Delete the saved accounts.", + Short: "Delete the saved accounts", Long: "Delete accounts. " + "Accepts space-separated list of usernames. " + "If no arguments, all records will be deleted.", diff --git a/cmd/add.go b/cmd/add.go index 9ebdf73..94735e5 100644 --- a/cmd/add.go +++ b/cmd/add.go @@ -1,18 +1,19 @@ package cmd import ( - "github.com/RadhiFadlillah/go-readability" - "github.com/RadhiFadlillah/shiori/model" - "github.com/spf13/cobra" "html/template" "strings" "time" + + "github.com/RadhiFadlillah/go-readability" + "github.com/RadhiFadlillah/shiori/model" + "github.com/spf13/cobra" ) var ( addCmd = &cobra.Command{ Use: "add url", - Short: "Bookmark the specified URL.", + Short: "Bookmark the specified URL", Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { // Read flag and arguments diff --git a/cmd/delete.go b/cmd/delete.go index 62c6ed3..00b98db 100644 --- a/cmd/delete.go +++ b/cmd/delete.go @@ -2,14 +2,15 @@ package cmd import ( "fmt" - "github.com/spf13/cobra" "os" + + "github.com/spf13/cobra" ) var ( deleteCmd = &cobra.Command{ Use: "delete [indices]", - Short: "Delete the saved bookmarks.", + Short: "Delete the saved bookmarks", Long: "Delete bookmarks. " + "When a record is deleted, the last record is moved to the removed index. " + "Accepts space-separated list of indices (e.g. 5 6 23 4 110 45), hyphenated range (e.g. 100-200) or both (e.g. 1-3 7 9). " + diff --git a/cmd/export.go b/cmd/export.go index 14a94ba..050da8f 100644 --- a/cmd/export.go +++ b/cmd/export.go @@ -2,18 +2,19 @@ package cmd import ( "fmt" - "github.com/RadhiFadlillah/shiori/model" - "github.com/spf13/cobra" "html/template" "os" "strings" "time" + + "github.com/RadhiFadlillah/shiori/model" + "github.com/spf13/cobra" ) var ( exportCmd = &cobra.Command{ Use: "export target-file", - Short: "Export bookmarks into HTML file in Netscape Bookmark format.", + Short: "Export bookmarks into HTML file in Netscape Bookmark format", Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { err := exportBookmarks(args[0]) diff --git a/cmd/import.go b/cmd/import.go index 19bf191..9f1895a 100644 --- a/cmd/import.go +++ b/cmd/import.go @@ -2,19 +2,20 @@ package cmd import ( "fmt" - "github.com/PuerkitoBio/goquery" - "github.com/RadhiFadlillah/shiori/model" - "github.com/spf13/cobra" "os" "strconv" "strings" "time" + + "github.com/PuerkitoBio/goquery" + "github.com/RadhiFadlillah/shiori/model" + "github.com/spf13/cobra" ) var ( importCmd = &cobra.Command{ Use: "import source-file", - Short: "Import bookmarks from HTML file in Netscape Bookmark format.", + Short: "Import bookmarks from HTML file in Netscape Bookmark format", Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { generateTag := cmd.Flags().Changed("generate-tag") diff --git a/cmd/open.go b/cmd/open.go index e94368d..6dc94ab 100644 --- a/cmd/open.go +++ b/cmd/open.go @@ -2,15 +2,16 @@ package cmd import ( "fmt" - "github.com/spf13/cobra" "os/exec" "strings" + + "github.com/spf13/cobra" ) var ( openCmd = &cobra.Command{ Use: "open [indices]", - Short: "Open the saved bookmarks.", + Short: "Open the saved bookmarks", Long: "Open bookmarks in browser. " + "Accepts space-separated list of indices (e.g. 5 6 23 4 110 45), hyphenated range (e.g. 100-200) or both (e.g. 1-3 7 9). " + "If no arguments, ALL bookmarks will be opened.", diff --git a/cmd/print.go b/cmd/print.go index 9fa9f0e..407e396 100644 --- a/cmd/print.go +++ b/cmd/print.go @@ -3,16 +3,17 @@ package cmd import ( "encoding/json" "fmt" - "github.com/RadhiFadlillah/shiori/model" - "github.com/spf13/cobra" "os" "strings" + + "github.com/RadhiFadlillah/shiori/model" + "github.com/spf13/cobra" ) var ( printCmd = &cobra.Command{ Use: "print [indices]", - Short: "Print the saved bookmarks.", + Short: "Print the saved bookmarks", Long: "Show the saved bookmarks by its DB index. " + "Accepts space-separated list of indices (e.g. 5 6 23 4 110 45), hyphenated range (e.g. 100-200) or both (e.g. 1-3 7 9). " + "If no arguments, all records with actual index from DB are shown.", diff --git a/cmd/root.go b/cmd/root.go index 6030f83..5112159 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -2,9 +2,10 @@ package cmd import ( "fmt" + "os" + "github.com/RadhiFadlillah/shiori/database" "github.com/spf13/cobra" - "os" ) var ( @@ -13,7 +14,7 @@ var ( rootCmd = &cobra.Command{ Use: "shiori", - Short: "Simple command-line bookmark manager built with Go.", + Short: "Simple command-line bookmark manager built with Go", } ) diff --git a/cmd/search.go b/cmd/search.go index bb8575d..208b89b 100644 --- a/cmd/search.go +++ b/cmd/search.go @@ -3,14 +3,15 @@ package cmd import ( "encoding/json" "fmt" - "github.com/spf13/cobra" "os" + + "github.com/spf13/cobra" ) var ( searchCmd = &cobra.Command{ Use: "search keyword", - Short: "Search bookmarks by submitted keyword.", + Short: "Search bookmarks by submitted keyword", Long: "Search bookmarks by looking for matching keyword in bookmark's title and content. " + "If no keyword submitted, print all saved bookmarks. " + "Search results will be different depending on DBMS that used by shiori :\n" + diff --git a/cmd/serve.go b/cmd/serve.go index 4999aed..e321dbb 100644 --- a/cmd/serve.go +++ b/cmd/serve.go @@ -5,6 +5,14 @@ import ( "crypto/rand" "encoding/json" "fmt" + "html/template" + "io" + "mime" + "net/http" + fp "path/filepath" + "strings" + "time" + "github.com/RadhiFadlillah/shiori/assets" "github.com/RadhiFadlillah/shiori/model" "github.com/dgrijalva/jwt-go" @@ -13,13 +21,6 @@ import ( "github.com/sirupsen/logrus" "github.com/spf13/cobra" "golang.org/x/crypto/bcrypt" - "html/template" - "io" - "mime" - "net/http" - fp "path/filepath" - "strings" - "time" ) var ( @@ -27,7 +28,7 @@ var ( tplCache *template.Template serveCmd = &cobra.Command{ Use: "serve", - Short: "Serve web app for managing bookmarks.", + Short: "Serve web app for managing bookmarks", Long: "Run a simple annd performant web server which serves the site for managing bookmarks." + "If --port flag is not used, it will use port 8080 by default.", Run: func(cmd *cobra.Command, args []string) { diff --git a/cmd/update.go b/cmd/update.go index 6d4b4a2..3dbf570 100644 --- a/cmd/update.go +++ b/cmd/update.go @@ -2,20 +2,21 @@ package cmd import ( "fmt" - "github.com/RadhiFadlillah/go-readability" - "github.com/RadhiFadlillah/shiori/model" - "github.com/spf13/cobra" "html/template" "strconv" "strings" "sync" "time" + + "github.com/RadhiFadlillah/go-readability" + "github.com/RadhiFadlillah/shiori/model" + "github.com/spf13/cobra" ) var ( updateCmd = &cobra.Command{ Use: "update [indices]", - Short: "Update the saved bookmarks.", + Short: "Update the saved bookmarks", Long: "Update fields of an existing bookmark. " + "Accepts space-separated list of indices (e.g. 5 6 23 4 110 45), hyphenated range (e.g. 100-200) or both (e.g. 1-3 7 9). " + "If no arguments, ALL bookmarks will be updated. Update works differently depending on the flags:\n" +