filebrowser/cmd/config_export.go
Henrique Dias e1026a1fb4 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
2019-01-08 16:37:02 +00:00

38 lines
845 B
Go

package cmd
import (
"github.com/spf13/cobra"
)
func init() {
configCmd.AddCommand(configExportCmd)
}
var configExportCmd = &cobra.Command{
Use: "export <path>",
Short: "Export the configuration to a file",
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)
server, err := d.store.Settings.GetServer()
checkErr(err)
auther, err := d.store.Auth.Get(settings.AuthMethod)
checkErr(err)
data := &settingsFile{
Settings: settings,
Auther: auther,
Server: server,
}
err = marshal(args[0], data)
checkErr(err)
}, pythonConfig{}),
}