feat: add docs info

License: MIT
Signed-off-by: Henrique Dias <hacdias@gmail.com>

Former-commit-id: 4cc444f7168a76920c2821534027f121b7b0b0d5 [formerly fc1b399bbcf6cbd0a26db133ce644192664e4987] [formerly c71a14856c55345626eb7982e2bbe9ca0b7a1aec [formerly e68af011d4]]
Former-commit-id: b6ec8dd8817ec6bf028e1e7df299f8dd720628d9 [formerly 99077c4ca6faac93a1c956d96833faa3f2c40fe6]
Former-commit-id: 620919fdfd9f213cc61e4ce3b4e8650096a489b4
pull/726/head
Henrique Dias 2019-01-08 16:37:02 +00:00
parent 4703e0d36f
commit e1026a1fb4
9 changed files with 38 additions and 14 deletions

View File

@ -13,7 +13,15 @@ func init() {
var cmdsRmCmd = &cobra.Command{
Use: "rm <event> <index> [index_end]",
Short: "Removes a command from an event hooker",
Long: `Removes a command from an event hooker.`,
Long: `Removes a command from an event hooker. The provided index
is the same that's printed when you run 'cmds ls'. Note
that after each removal/addition, the index of the
commands change. So be careful when removing them after each
other.
You can also specify an optional parameter (index_end) so
you can remove all commands from 'index' to 'index_end',
including 'index_end'.`,
Args: func(cmd *cobra.Command, args []string) error {
if err := cobra.RangeArgs(2, 3)(cmd, args); err != nil {
return err

View File

@ -9,10 +9,12 @@ func init() {
}
var configExportCmd = &cobra.Command{
Use: "export <filename>",
Use: "export <path>",
Short: "Export the configuration to a file",
Long: "Export the configuration to a file.",
Args: jsonYamlArg,
Long: `Export the configuration to a file. The path must be for a
json or yaml file. This exported configuration can be changed,
and imported again with 'config import' command.`,
Args: jsonYamlArg,
Run: python(func(cmd *cobra.Command, args []string, d pythonData) {
settings, err := d.store.Settings.Get()
checkErr(err)

View File

@ -22,13 +22,16 @@ type settingsFile struct {
}
var configImportCmd = &cobra.Command{
Use: "import <filename>",
Use: "import <path>",
Short: "Import a configuration file",
Long: `Import a configuration file. This will replace all the existing
configuration. Can be used with or without unexisting databases.
If used with a nonexisting database, a key will be generated
automatically. Otherwise the key will be kept the same as in the
database.`,
database.
The path must be for a json or yaml file.`,
Args: jsonYamlArg,
Run: python(func(cmd *cobra.Command, args []string, d pythonData) {
var key []byte

View File

@ -18,7 +18,7 @@ var configInitCmd = &cobra.Command{
Short: "Initialize a new database",
Long: `Initialize a new database to use with File Browser. All of
this options can be changed in the future with the command
"filebrowser config set". The user related flags apply
'filebrowser config set'. The user related flags apply
to the defaults when creating new users and you don't
override the options.`,
Args: cobra.NoArgs,

View File

@ -17,7 +17,7 @@ var configSetCmd = &cobra.Command{
Use: "set",
Short: "Updates the configuration",
Long: `Updates the configuration. Set the flags for the options
you want to change.`,
you want to change. Other options will remain unchanged.`,
Args: cobra.NoArgs,
Run: python(func(cmd *cobra.Command, args []string, d pythonData) {
flags := cmd.Flags()

View File

@ -9,8 +9,8 @@ import (
"sort"
"strings"
"github.com/spf13/pflag"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
)
func init() {

View File

@ -17,7 +17,15 @@ func init() {
var rulesRmCommand = &cobra.Command{
Use: "rm <index> [index_end]",
Short: "Remove a global rule or user rule",
Long: `Remove a global rule or user rule.`,
Long: `Remove a global rule or user rule. The provided index
is the same that's printed when you run 'rules ls'. Note
that after each removal/addition, the index of the
commands change. So be careful when removing them after each
other.
You can also specify an optional parameter (index_end) so
you can remove all commands from 'index' to 'index_end',
including 'index_end'.`,
Args: func(cmd *cobra.Command, args []string) error {
if err := cobra.RangeArgs(1, 2)(cmd, args); err != nil {
return err

View File

@ -9,7 +9,7 @@ func init() {
}
var usersExportCmd = &cobra.Command{
Use: "export <filename>",
Use: "export <path>",
Short: "Export all users to a file.",
Long: `Export all users to a json or yaml file. Please indicate the
path to the file where you want to write the users.`,

View File

@ -16,10 +16,13 @@ func init() {
}
var usersImportCmd = &cobra.Command{
Use: "import <filename>",
Use: "import <path>",
Short: "Import users from a file",
Long: "Import users from a file.",
Args: jsonYamlArg,
Long: `Import users from a file. The path must be for a json or yaml
file. You can use this command to import new users to your
installation. For that, just don't place their ID on the files
list or set it to 0.`,
Args: jsonYamlArg,
Run: python(func(cmd *cobra.Command, args []string, d pythonData) {
fd, err := os.Open(args[0])
checkErr(err)