uyuni-project / inter-server-sync

6 stars 13 forks source link

Support configuration file for export command #55

Open WordlessEcho opened 1 year ago

WordlessEcho commented 1 year ago

Resolves #54

If both command parameters and configuration file is specified. It will respect the options of command parameters. Improvement: Maybe we should make default value of command parameters as constant?

Tested on my environment by following configurations: ~/config.json

{
    "outputDir": "~/export-test",
    "channels": ["t"]
}
go build
./inter-server-sync export --config=~/config.json --channels=testchannel

Result:

$ cat ~/export-test/exportedChannels.txt
testchannel
WordlessEcho commented 1 year ago

About 5be4e6d : ServerConfig is belongs to cmd/root.go. I think we should not change it in cmd/export.go?

WordlessEcho commented 1 year ago

I found some bug in recent commits. Waiting for fix.

WordlessEcho commented 1 year ago

Bug fixed. About the --config option: I wrote some codes to move it into cmd/root.go as global flag but not pushed yet.