Cleaned up command imports and descriptions

This commit is contained in:
Christian Muehlhaeuser 2018-03-02 13:29:26 +01:00
parent 3826d4b7ab
commit 77a7ffd740
No known key found for this signature in database
GPG Key ID: BA4CF857DD4117E9
12 changed files with 60 additions and 49 deletions

View File

@ -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

View File

@ -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.",

View File

@ -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

View File

@ -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). " +

View File

@ -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])

View File

@ -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")

View File

@ -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.",

View File

@ -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.",

View File

@ -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",
}
)

View File

@ -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" +

View File

@ -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) {

View File

@ -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" +