1
mirror of https://github.com/rclone/rclone synced 2024-10-15 00:25:20 +02:00

config: add empty line between sections to improve readability

See #6211
This commit is contained in:
albertony 2022-05-28 13:52:48 +02:00
parent ef089dd867
commit 61a75bfe07

View File

@ -338,6 +338,11 @@ func OkRemote(name string) bool {
return false return false
} }
// newSection prints an empty line to separate sections
func newSection() {
fmt.Println()
}
// backendConfig configures the backend starting from the state passed in // backendConfig configures the backend starting from the state passed in
// //
// The is the user interface loop that drives the post configuration backend config. // The is the user interface loop that drives the post configuration backend config.
@ -387,6 +392,7 @@ func backendConfig(ctx context.Context, name string, m configmap.Mapper, ri *fs.
if out.State == "" { if out.State == "" {
break break
} }
newSection()
} }
return nil return nil
} }
@ -516,7 +522,7 @@ func NewRemote(ctx context.Context, name string) error {
break break
} }
LoadedData().SetValue(name, "type", newType) LoadedData().SetValue(name, "type", newType)
newSection()
_, err = CreateRemote(ctx, name, newType, nil, UpdateRemoteOpt{ _, err = CreateRemote(ctx, name, newType, nil, UpdateRemoteOpt{
All: true, All: true,
}) })
@ -527,13 +533,15 @@ func NewRemote(ctx context.Context, name string) error {
SaveConfig() SaveConfig()
return nil return nil
} }
newSection()
return EditRemote(ctx, ri, name) return EditRemote(ctx, ri, name)
} }
// EditRemote gets the user to edit a remote // EditRemote gets the user to edit a remote
func EditRemote(ctx context.Context, ri *fs.RegInfo, name string) error { func EditRemote(ctx context.Context, ri *fs.RegInfo, name string) error {
ShowRemote(name)
fmt.Printf("Edit remote\n") fmt.Printf("Edit remote\n")
ShowRemote(name)
newSection()
for { for {
_, err := UpdateRemote(ctx, name, nil, UpdateRemoteOpt{ _, err := UpdateRemote(ctx, name, nil, UpdateRemoteOpt{
All: true, All: true,
@ -626,29 +634,44 @@ func EditConfig(ctx context.Context) (err error) {
} }
switch i := Command(what); i { switch i := Command(what); i {
case 'e': case 'e':
newSection()
name := ChooseRemote() name := ChooseRemote()
newSection()
fs := mustFindByName(name) fs := mustFindByName(name)
err = EditRemote(ctx, fs, name) err = EditRemote(ctx, fs, name)
if err != nil { if err != nil {
return err return err
} }
case 'n': case 'n':
err = NewRemote(ctx, NewRemoteName()) newSection()
name := NewRemoteName()
newSection()
err = NewRemote(ctx, name)
if err != nil { if err != nil {
return err return err
} }
case 'd': case 'd':
newSection()
name := ChooseRemote() name := ChooseRemote()
newSection()
DeleteRemote(name) DeleteRemote(name)
case 'r': case 'r':
RenameRemote(ChooseRemote()) newSection()
name := ChooseRemote()
newSection()
RenameRemote(name)
case 'c': case 'c':
CopyRemote(ChooseRemote()) newSection()
name := ChooseRemote()
newSection()
CopyRemote(name)
case 's': case 's':
newSection()
SetPassword() SetPassword()
case 'q': case 'q':
return nil return nil
} }
newSection()
} }
} }