mirror of
https://github.com/filebrowser/filebrowser.git
synced 2024-06-07 23:00:43 +00:00
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
This commit is contained in:
parent
4703e0d36f
commit
e1026a1fb4
@ -13,7 +13,15 @@ func init() {
|
|||||||
var cmdsRmCmd = &cobra.Command{
|
var cmdsRmCmd = &cobra.Command{
|
||||||
Use: "rm <event> <index> [index_end]",
|
Use: "rm <event> <index> [index_end]",
|
||||||
Short: "Removes a command from an event hooker",
|
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 {
|
Args: func(cmd *cobra.Command, args []string) error {
|
||||||
if err := cobra.RangeArgs(2, 3)(cmd, args); err != nil {
|
if err := cobra.RangeArgs(2, 3)(cmd, args); err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -9,10 +9,12 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var configExportCmd = &cobra.Command{
|
var configExportCmd = &cobra.Command{
|
||||||
Use: "export <filename>",
|
Use: "export <path>",
|
||||||
Short: "Export the configuration to a file",
|
Short: "Export the configuration to a file",
|
||||||
Long: "Export the configuration to a file.",
|
Long: `Export the configuration to a file. The path must be for a
|
||||||
Args: jsonYamlArg,
|
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) {
|
Run: python(func(cmd *cobra.Command, args []string, d pythonData) {
|
||||||
settings, err := d.store.Settings.Get()
|
settings, err := d.store.Settings.Get()
|
||||||
checkErr(err)
|
checkErr(err)
|
||||||
|
@ -22,13 +22,16 @@ type settingsFile struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var configImportCmd = &cobra.Command{
|
var configImportCmd = &cobra.Command{
|
||||||
Use: "import <filename>",
|
Use: "import <path>",
|
||||||
Short: "Import a configuration file",
|
Short: "Import a configuration file",
|
||||||
Long: `Import a configuration file. This will replace all the existing
|
Long: `Import a configuration file. This will replace all the existing
|
||||||
configuration. Can be used with or without unexisting databases.
|
configuration. Can be used with or without unexisting databases.
|
||||||
|
|
||||||
If used with a nonexisting database, a key will be generated
|
If used with a nonexisting database, a key will be generated
|
||||||
automatically. Otherwise the key will be kept the same as in the
|
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,
|
Args: jsonYamlArg,
|
||||||
Run: python(func(cmd *cobra.Command, args []string, d pythonData) {
|
Run: python(func(cmd *cobra.Command, args []string, d pythonData) {
|
||||||
var key []byte
|
var key []byte
|
||||||
|
@ -18,7 +18,7 @@ var configInitCmd = &cobra.Command{
|
|||||||
Short: "Initialize a new database",
|
Short: "Initialize a new database",
|
||||||
Long: `Initialize a new database to use with File Browser. All of
|
Long: `Initialize a new database to use with File Browser. All of
|
||||||
this options can be changed in the future with the command
|
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
|
to the defaults when creating new users and you don't
|
||||||
override the options.`,
|
override the options.`,
|
||||||
Args: cobra.NoArgs,
|
Args: cobra.NoArgs,
|
||||||
|
@ -17,7 +17,7 @@ var configSetCmd = &cobra.Command{
|
|||||||
Use: "set",
|
Use: "set",
|
||||||
Short: "Updates the configuration",
|
Short: "Updates the configuration",
|
||||||
Long: `Updates the configuration. Set the flags for the options
|
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,
|
Args: cobra.NoArgs,
|
||||||
Run: python(func(cmd *cobra.Command, args []string, d pythonData) {
|
Run: python(func(cmd *cobra.Command, args []string, d pythonData) {
|
||||||
flags := cmd.Flags()
|
flags := cmd.Flags()
|
||||||
|
@ -9,8 +9,8 @@ import (
|
|||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/spf13/pflag"
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
"github.com/spf13/pflag"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -17,7 +17,15 @@ func init() {
|
|||||||
var rulesRmCommand = &cobra.Command{
|
var rulesRmCommand = &cobra.Command{
|
||||||
Use: "rm <index> [index_end]",
|
Use: "rm <index> [index_end]",
|
||||||
Short: "Remove a global rule or user rule",
|
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 {
|
Args: func(cmd *cobra.Command, args []string) error {
|
||||||
if err := cobra.RangeArgs(1, 2)(cmd, args); err != nil {
|
if err := cobra.RangeArgs(1, 2)(cmd, args); err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -9,7 +9,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var usersExportCmd = &cobra.Command{
|
var usersExportCmd = &cobra.Command{
|
||||||
Use: "export <filename>",
|
Use: "export <path>",
|
||||||
Short: "Export all users to a file.",
|
Short: "Export all users to a file.",
|
||||||
Long: `Export all users to a json or yaml file. Please indicate the
|
Long: `Export all users to a json or yaml file. Please indicate the
|
||||||
path to the file where you want to write the users.`,
|
path to the file where you want to write the users.`,
|
||||||
|
@ -16,10 +16,13 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var usersImportCmd = &cobra.Command{
|
var usersImportCmd = &cobra.Command{
|
||||||
Use: "import <filename>",
|
Use: "import <path>",
|
||||||
Short: "Import users from a file",
|
Short: "Import users from a file",
|
||||||
Long: "Import users from a file.",
|
Long: `Import users from a file. The path must be for a json or yaml
|
||||||
Args: jsonYamlArg,
|
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) {
|
Run: python(func(cmd *cobra.Command, args []string, d pythonData) {
|
||||||
fd, err := os.Open(args[0])
|
fd, err := os.Open(args[0])
|
||||||
checkErr(err)
|
checkErr(err)
|
||||||
|
Loading…
Reference in New Issue
Block a user