'more bubbletea, less look bad plz'
This commit is contained in:
58
app.go
58
app.go
@@ -132,9 +132,9 @@ func (a *App) chooseStartupWorkflow() (string, error) {
|
||||
"Use the client tools to add or maintain CIFS mounts in /etc/fstab.",
|
||||
},
|
||||
[]menuOption{
|
||||
{Key: "s", Value: "server", Label: "Set up or edit shares on this computer", Description: "Create, edit, and save Samba share definitions."},
|
||||
{Key: "c", Value: "client", Label: "Connect this computer to a remote share", Description: "Manage CIFS client mounts and mount points."},
|
||||
{Key: "q", Value: "quit", Label: "Quit", Description: "Exit without changing anything."},
|
||||
{Key: "s", Value: "server", Label: "Server shares"},
|
||||
{Key: "c", Value: "client", Label: "Client mounts"},
|
||||
{Key: "q", Value: "quit", Label: "Quit"},
|
||||
},
|
||||
)
|
||||
}
|
||||
@@ -170,13 +170,13 @@ loaded:
|
||||
fmt.Sprintf("Working against %s", a.configPath),
|
||||
intro,
|
||||
[]menuOption{
|
||||
{Key: "a", Value: "add", Label: "Add share", Description: "Create a new share definition."},
|
||||
{Key: "e", Value: "edit", Label: "Edit share", Description: "Update an existing share."},
|
||||
{Key: "d", Value: "delete", Label: "Delete share", Description: "Remove a share definition."},
|
||||
{Key: "m", Value: "mount", Label: "Set up client mount", Description: "Jump to the remote-mount workflow."},
|
||||
{Key: "u", Value: "users", Label: "Manage users", Description: "Check accounts, passwords, and cleanup."},
|
||||
{Key: "w", Value: "write", Label: "Write config and exit", Description: "Save smb.conf and leave the app."},
|
||||
{Key: "q", Value: "quit", Label: "Quit without saving", Description: "Leave the editor immediately."},
|
||||
{Key: "a", Value: "add", Label: "Add share"},
|
||||
{Key: "e", Value: "edit", Label: "Edit share"},
|
||||
{Key: "d", Value: "delete", Label: "Delete share"},
|
||||
{Key: "m", Value: "mount", Label: "Client mounts"},
|
||||
{Key: "u", Value: "users", Label: "Users"},
|
||||
{Key: "w", Value: "write", Label: "Write and exit"},
|
||||
{Key: "q", Value: "quit", Label: "Quit"},
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
@@ -239,10 +239,10 @@ func (a *App) setupClientMount() error {
|
||||
fmt.Sprintf("Editing %s", a.fstabPath),
|
||||
intro,
|
||||
[]menuOption{
|
||||
{Key: "a", Value: "add", Label: "Add client mount", Description: "Create a new CIFS mount entry."},
|
||||
{Key: "e", Value: "edit", Label: "Edit client mount", Description: "Change an existing mount definition."},
|
||||
{Key: "d", Value: "delete", Label: "Delete client mount", Description: "Remove a saved mount entry."},
|
||||
{Key: "b", Value: "back", Label: "Back", Description: "Return to the previous menu."},
|
||||
{Key: "a", Value: "add", Label: "Add mount"},
|
||||
{Key: "e", Value: "edit", Label: "Edit mount"},
|
||||
{Key: "d", Value: "delete", Label: "Delete mount"},
|
||||
{Key: "b", Value: "back", Label: "Back"},
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
@@ -280,10 +280,10 @@ func (a *App) manageUsers(doc *Document) error {
|
||||
fmt.Sprintf("%d share accounts referenced in the current config.", len(shareUserReferences(doc))),
|
||||
},
|
||||
[]menuOption{
|
||||
{Key: "c", Value: "check", Label: "Check share accounts", Description: "Create missing local users referenced by shares."},
|
||||
{Key: "p", Value: "password", Label: "Change a Samba password", Description: "Set or update a Samba credential."},
|
||||
{Key: "x", Value: "delete", Label: "Delete an unused account", Description: "Remove unused share-style accounts."},
|
||||
{Key: "b", Value: "back", Label: "Back", Description: "Return to the share editor."},
|
||||
{Key: "c", Value: "check", Label: "Check accounts"},
|
||||
{Key: "p", Value: "password", Label: "Change password"},
|
||||
{Key: "x", Value: "delete", Label: "Delete account"},
|
||||
{Key: "b", Value: "back", Label: "Back"},
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
@@ -370,7 +370,7 @@ func (a *App) deleteUnusedAccount(doc *Document) error {
|
||||
Description: "shell: " + strings.TrimSpace(entry.Shell),
|
||||
})
|
||||
}
|
||||
options = append(options, menuOption{Key: "b", Value: "", Label: "Back", Description: "Leave accounts unchanged."})
|
||||
options = append(options, menuOption{Key: "b", Value: "", Label: "Back"})
|
||||
|
||||
choice, err := a.chooseMenu(
|
||||
"Delete An Unused Account",
|
||||
@@ -435,7 +435,7 @@ func (a *App) changeSambaPassword(doc *Document) error {
|
||||
Description: "used by: " + strings.Join(ref.Shares, ", "),
|
||||
})
|
||||
}
|
||||
options = append(options, menuOption{Key: "b", Value: "", Label: "Back", Description: "Return without changing a password."})
|
||||
options = append(options, menuOption{Key: "b", Value: "", Label: "Back"})
|
||||
|
||||
choice, err := a.chooseMenu(
|
||||
"Choose An Account",
|
||||
@@ -667,7 +667,7 @@ func (a *App) collectCIFSMountConfig(defaults CIFSMountConfig) (CIFSMountConfig,
|
||||
if err != nil {
|
||||
return CIFSMountConfig{}, err
|
||||
}
|
||||
share, err := a.promptDefault("Share name on that server", defaults.Share)
|
||||
share, err := a.promptDefault("Share name", defaults.Share)
|
||||
if err != nil {
|
||||
return CIFSMountConfig{}, err
|
||||
}
|
||||
@@ -679,23 +679,23 @@ func (a *App) collectCIFSMountConfig(defaults CIFSMountConfig) (CIFSMountConfig,
|
||||
if err != nil {
|
||||
return CIFSMountConfig{}, err
|
||||
}
|
||||
username, err := a.promptDefault("Username for the remote share", defaults.Username)
|
||||
username, err := a.promptDefault("Remote username", defaults.Username)
|
||||
if err != nil {
|
||||
return CIFSMountConfig{}, err
|
||||
}
|
||||
password, err := a.promptDefault("Password for the remote share", defaults.Password)
|
||||
password, err := a.promptDefault("Remote password", defaults.Password)
|
||||
if err != nil {
|
||||
return CIFSMountConfig{}, err
|
||||
}
|
||||
domain, err := a.promptDefault("Domain or workgroup (optional)", defaults.Domain)
|
||||
domain, err := a.promptDefault("Domain or workgroup", defaults.Domain)
|
||||
if err != nil {
|
||||
return CIFSMountConfig{}, err
|
||||
}
|
||||
uid, err := a.promptDefault("Local owner username or uid (optional)", defaults.UID)
|
||||
uid, err := a.promptDefault("Local owner username or uid", defaults.UID)
|
||||
if err != nil {
|
||||
return CIFSMountConfig{}, err
|
||||
}
|
||||
gid, err := a.promptDefault("Local group name or gid (optional)", defaults.GID)
|
||||
gid, err := a.promptDefault("Local group name or gid", defaults.GID)
|
||||
if err != nil {
|
||||
return CIFSMountConfig{}, err
|
||||
}
|
||||
@@ -1143,8 +1143,8 @@ func (a *App) promptDefault(label, defaultValue string) (string, error) {
|
||||
|
||||
func (a *App) confirm(label string, defaultYes bool) (bool, error) {
|
||||
options := []menuOption{
|
||||
{Key: "y", Value: "yes", Label: "Yes", Description: "Continue with this action."},
|
||||
{Key: "n", Value: "no", Label: "No", Description: "Leave things as they are."},
|
||||
{Key: "y", Value: "yes", Label: "Yes"},
|
||||
{Key: "n", Value: "no", Label: "No"},
|
||||
}
|
||||
if !defaultYes {
|
||||
options[0], options[1] = options[1], options[0]
|
||||
@@ -1681,7 +1681,7 @@ func (a *App) selectCIFSMount(entries []FstabMountEntry) (*FstabMountEntry, erro
|
||||
Description: entry.MountPoint,
|
||||
})
|
||||
}
|
||||
options = append(options, menuOption{Key: "b", Value: "", Label: "Back", Description: "Return to the previous menu."})
|
||||
options = append(options, menuOption{Key: "b", Value: "", Label: "Back"})
|
||||
|
||||
selection, err := a.chooseMenu("Choose A Client Mount", "Select the saved mount entry you want to change.", nil, options)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user