docs: improve some cli docs

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

Former-commit-id: f7710895557fc2f181dc04b07cef1bf8e612bd9b [formerly bf7a392bc9e83971ddc9ae673f4fedf8772d3ed1] [formerly 06404f0eb55f410bb6cab197021bdd5e5c0991a2 [formerly 2ba5a4275a]]
Former-commit-id: 5a676627143edb8d7ca474b564fe2ab3c6b610c3 [formerly edbc0e60c66ab62df1611cda766fc8b3c8ac837e]
Former-commit-id: 2925d9dd6471f900c59adb495a5c2f7abfe0026e
pull/726/head
Henrique Dias 2019-01-08 16:09:25 +00:00
parent 2e1553542b
commit 4703e0d36f
5 changed files with 14 additions and 8 deletions

View File

@ -10,7 +10,8 @@ func init() {
var configExportCmd = &cobra.Command{
Use: "export <filename>",
Short: "Export the configuration to a file.",
Short: "Export the configuration to a file",
Long: "Export the configuration to a file.",
Args: jsonYamlArg,
Run: python(func(cmd *cobra.Command, args []string, d pythonData) {
settings, err := d.store.Settings.Get()

View File

@ -23,7 +23,8 @@ type settingsFile struct {
var configImportCmd = &cobra.Command{
Use: "import <filename>",
Short: `Import a configuration file. This will replace all the existing
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

View File

@ -119,6 +119,7 @@ The precedence of the configuration values are as follows:
- flag
- environment variable
- configuration file
- database values
- defaults
The environment variables are prefixed by "FB_" followed by the option

View File

@ -10,8 +10,10 @@ func init() {
var usersExportCmd = &cobra.Command{
Use: "export <filename>",
Short: "Export all users.",
Args: jsonYamlArg,
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.`,
Args: jsonYamlArg,
Run: python(func(cmd *cobra.Command, args []string, d pythonData) {
list, err := d.store.Users.Gets("")
checkErr(err)

View File

@ -17,7 +17,8 @@ func init() {
var usersImportCmd = &cobra.Command{
Use: "import <filename>",
Short: "Import users from a file.",
Short: "Import users from a file",
Long: "Import users from a file.",
Args: jsonYamlArg,
Run: python(func(cmd *cobra.Command, args []string, d pythonData) {
fd, err := os.Open(args[0])
@ -36,16 +37,16 @@ var usersImportCmd = &cobra.Command{
if mustGetBool(cmd.Flags(), "replace") {
oldUsers, err := d.store.Users.Gets("")
checkErr(err)
err = marshal("users.backup.json", list)
checkErr(err)
for _, user := range oldUsers {
err = d.store.Users.Delete(user.ID)
checkErr(err)
}
}
overwrite := mustGetBool(cmd.Flags(), "overwrite")
for _, user := range list {