Skip to content

Commit

Permalink
feat: change assume-yes wording to no-prompt
Browse files Browse the repository at this point in the history
- change all occurances of assume-yes to no-prompt
- change locales string name for prompt help
- change wording of en noprompt string message
  • Loading branch information
jardon committed Oct 17, 2024
1 parent 3767a1a commit c5caf50
Show file tree
Hide file tree
Showing 32 changed files with 125 additions and 125 deletions.
40 changes: 20 additions & 20 deletions cmd/pkgManagers.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ func NewPkgManagersCommand() *cmdr.Command {

newCmd.WithBoolFlag(
cmdr.NewBoolFlag(
"assume-yes",
"no-prompt",
"y",
apx.Trans("pkgmanagers.new.options.assumeYes.description"),
apx.Trans("pkgmanagers.new.options.noPrompt.description"),
false,
),
)
Expand Down Expand Up @@ -259,9 +259,9 @@ func NewPkgManagersCommand() *cmdr.Command {
)
updateCmd.WithBoolFlag(
cmdr.NewBoolFlag(
"assume-yes",
"no-prompt",
"y",
apx.Trans("pkgmanagers.new.options.assumeYes.description"),
apx.Trans("pkgmanagers.new.options.noPrompt.description"),
false,
),
)
Expand Down Expand Up @@ -419,7 +419,7 @@ func showPkgManager(cmd *cobra.Command, args []string) error {
}

func newPkgManager(cmd *cobra.Command, args []string) error {
assumeYes, _ := cmd.Flags().GetBool("assume-yes")
noPrompt, _ := cmd.Flags().GetBool("no-prompt")
name, _ := cmd.Flags().GetString("name")
needSudo, _ := cmd.Flags().GetBool("need-sudo")
autoRemove, _ := cmd.Flags().GetString("autoremove")
Expand All @@ -436,7 +436,7 @@ func newPkgManager(cmd *cobra.Command, args []string) error {
reader := bufio.NewReader(os.Stdin)

if name == "" {
if assumeYes {
if noPrompt {
cmdr.Error.Println(apx.Trans("pkgmanagers.new.error.noName"))
return nil
}
Expand All @@ -451,7 +451,7 @@ func newPkgManager(cmd *cobra.Command, args []string) error {
}
}

if !needSudo && !assumeYes {
if !needSudo && !noPrompt {
validChoice := false
for !validChoice {
cmdr.Info.Println(apx.Trans("pkgmanagers.new.info.askSudo") + ` [y/N]`)
Expand Down Expand Up @@ -488,7 +488,7 @@ func newPkgManager(cmd *cobra.Command, args []string) error {

for cmdName, cmd := range cmdMap {
if *cmd == "" {
if assumeYes {
if noPrompt {
cmdr.Error.Printf(apx.Trans("pkgmanagers.new.error.noCommand"), cmdName)
return nil
}
Expand All @@ -504,7 +504,7 @@ func newPkgManager(cmd *cobra.Command, args []string) error {
}

if core.PkgManagerExists(name) {
if assumeYes {
if noPrompt {
cmdr.Error.Println(apx.Trans("pkgmanagers.new.error.alreadyExists"), name)
return nil
}
Expand Down Expand Up @@ -648,7 +648,7 @@ func importPkgmanager(cmd *cobra.Command, args []string) error {
func updatePkgManager(cmd *cobra.Command, args []string) error {
name, _ := cmd.Flags().GetString("name")
needSudo, _ := cmd.Flags().GetBool("need-sudo")
assumeYes, _ := cmd.Flags().GetBool("assume-yes")
noPrompt, _ := cmd.Flags().GetBool("no-prompt")
autoRemove, _ := cmd.Flags().GetString("autoremove")
clean, _ := cmd.Flags().GetString("clean")
install, _ := cmd.Flags().GetString("install")
Expand Down Expand Up @@ -683,7 +683,7 @@ func updatePkgManager(cmd *cobra.Command, args []string) error {
reader := bufio.NewReader(os.Stdin)

if autoRemove == "" {
if !assumeYes {
if !noPrompt {
cmdr.Info.Printfln(apx.Trans("pkgmanagers.update.info.askNewCommand"), "autoRemove", pkgmanager.CmdAutoRemove)
answer, _ := reader.ReadString('\n')
answer = strings.TrimSpace(answer)
Expand All @@ -699,7 +699,7 @@ func updatePkgManager(cmd *cobra.Command, args []string) error {
}

if clean == "" {
if !assumeYes {
if !noPrompt {
cmdr.Info.Printfln(apx.Trans("pkgmanagers.update.info.askNewCommand"), "clean", pkgmanager.CmdClean)
answer, _ := reader.ReadString('\n')
answer = strings.TrimSpace(answer)
Expand All @@ -715,7 +715,7 @@ func updatePkgManager(cmd *cobra.Command, args []string) error {
}

if install == "" {
if !assumeYes {
if !noPrompt {
cmdr.Info.Printfln(apx.Trans("pkgmanagers.update.info.askNewCommand"), "install", pkgmanager.CmdInstall)
answer, _ := reader.ReadString('\n')
answer = strings.TrimSpace(answer)
Expand All @@ -731,7 +731,7 @@ func updatePkgManager(cmd *cobra.Command, args []string) error {
}

if list == "" {
if !assumeYes {
if !noPrompt {
cmdr.Info.Printfln(apx.Trans("pkgmanagers.update.info.askNewCommand"), "list", pkgmanager.CmdList)
answer, _ := reader.ReadString('\n')
answer = strings.TrimSpace(answer)
Expand All @@ -747,7 +747,7 @@ func updatePkgManager(cmd *cobra.Command, args []string) error {
}

if purge == "" {
if !assumeYes {
if !noPrompt {
cmdr.Info.Printfln(apx.Trans("pkgmanagers.update.info.askNewCommand"), "purge", pkgmanager.CmdPurge)
answer, _ := reader.ReadString('\n')
answer = strings.TrimSpace(answer)
Expand All @@ -763,7 +763,7 @@ func updatePkgManager(cmd *cobra.Command, args []string) error {
}

if remove == "" {
if !assumeYes {
if !noPrompt {
cmdr.Info.Printfln(apx.Trans("pkgmanagers.update.info.askNewCommand"), "remove", pkgmanager.CmdRemove)
answer, _ := reader.ReadString('\n')
answer = strings.TrimSpace(answer)
Expand All @@ -779,7 +779,7 @@ func updatePkgManager(cmd *cobra.Command, args []string) error {
}

if search == "" {
if !assumeYes {
if !noPrompt {
cmdr.Info.Printfln(apx.Trans("pkgmanagers.update.info.askNewCommand"), "search", pkgmanager.CmdSearch)
answer, _ := reader.ReadString('\n')
answer = strings.TrimSpace(answer)
Expand All @@ -795,7 +795,7 @@ func updatePkgManager(cmd *cobra.Command, args []string) error {
}

if show == "" {
if !assumeYes {
if !noPrompt {
cmdr.Info.Printfln(apx.Trans("pkgmanagers.update.info.askNewCommand"), "show", pkgmanager.CmdShow)
answer, _ := reader.ReadString('\n')
answer = strings.TrimSpace(answer)
Expand All @@ -811,7 +811,7 @@ func updatePkgManager(cmd *cobra.Command, args []string) error {
}

if update == "" {
if !assumeYes {
if !noPrompt {
cmdr.Info.Printfln(apx.Trans("pkgmanagers.update.info.askNewCommand"), "update", pkgmanager.CmdUpdate)
answer, _ := reader.ReadString('\n')
answer = strings.TrimSpace(answer)
Expand All @@ -827,7 +827,7 @@ func updatePkgManager(cmd *cobra.Command, args []string) error {
}

if upgrade == "" {
if !assumeYes {
if !noPrompt {
cmdr.Info.Printfln(apx.Trans("pkgmanagers.update.info.askNewCommand"), "upgrade", pkgmanager.CmdUpgrade)
answer, _ := reader.ReadString('\n')
answer = strings.TrimSpace(answer)
Expand Down
24 changes: 12 additions & 12 deletions cmd/stacks.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ func NewStacksCommand() *cmdr.Command {
)
newCmd.WithBoolFlag(
cmdr.NewBoolFlag(
"assume-yes",
"no-prompt",
"y",
apx.Trans("stacks.new.options.assumeYes.description"),
apx.Trans("stacks.new.options.noPrompt.description"),
false,
),
)
Expand Down Expand Up @@ -113,9 +113,9 @@ func NewStacksCommand() *cmdr.Command {
)
updateCmd.WithBoolFlag(
cmdr.NewBoolFlag(
"assume-yes",
"no-prompt",
"y",
apx.Trans("stacks.update.options.assumeYes.description"),
apx.Trans("stacks.update.options.noPrompt.description"),
false,
),
)
Expand Down Expand Up @@ -284,14 +284,14 @@ func showStack(cmd *cobra.Command, args []string) error {
}

func newStack(cmd *cobra.Command, args []string) error {
assumeYes, _ := cmd.Flags().GetBool("assume-yes")
noPrompt, _ := cmd.Flags().GetBool("no-prompt")
name, _ := cmd.Flags().GetString("name")
base, _ := cmd.Flags().GetString("base")
packages, _ := cmd.Flags().GetString("packages")
pkgManager, _ := cmd.Flags().GetString("pkg-manager")

if name == "" {
if !assumeYes {
if !noPrompt {
cmdr.Info.Println(apx.Trans("stacks.new.info.askName"))
fmt.Scanln(&name)
if name == "" {
Expand All @@ -311,7 +311,7 @@ func newStack(cmd *cobra.Command, args []string) error {
}

if base == "" {
if !assumeYes {
if !noPrompt {
cmdr.Info.Println(apx.Trans("stacks.new.info.askBase"))
fmt.Scanln(&base)
if base == "" {
Expand Down Expand Up @@ -358,7 +358,7 @@ func newStack(cmd *cobra.Command, args []string) error {
}

packagesArray := strings.Fields(packages)
if len(packagesArray) == 0 && !assumeYes {
if len(packagesArray) == 0 && !noPrompt {
cmdr.Info.Println(apx.Trans("stacks.new.info.noPackages") + "[y/N]")
reader := bufio.NewReader(os.Stdin)
answer, _ := reader.ReadString('\n')
Expand Down Expand Up @@ -386,7 +386,7 @@ func newStack(cmd *cobra.Command, args []string) error {
}

func updateStack(cmd *cobra.Command, args []string) error {
assumeYes, _ := cmd.Flags().GetBool("assume-yes")
noPrompt, _ := cmd.Flags().GetBool("no-prompt")
name, _ := cmd.Flags().GetString("name")
base, _ := cmd.Flags().GetString("base")
packages, _ := cmd.Flags().GetString("packages")
Expand Down Expand Up @@ -414,7 +414,7 @@ func updateStack(cmd *cobra.Command, args []string) error {
}

if base == "" {
if !assumeYes {
if !noPrompt {
cmdr.Info.Printfln(apx.Trans("stacks.update.info.askBase"), stack.Base)
fmt.Scanln(&base)
if base == "" {
Expand All @@ -427,7 +427,7 @@ func updateStack(cmd *cobra.Command, args []string) error {
}

if pkgManager == "" {
if !assumeYes {
if !noPrompt {
cmdr.Info.Printfln(apx.Trans("stacks.update.info.askPkgManager"), stack.PkgManager)
fmt.Scanln(&pkgManager)
if pkgManager == "" {
Expand All @@ -447,7 +447,7 @@ func updateStack(cmd *cobra.Command, args []string) error {

packagesArray := strings.Fields(packages)
cmdr.Error.Printfln("packagearray: %s", packagesArray)
if len(packages) == 0 && !assumeYes {
if len(packages) == 0 && !noPrompt {
if len(stack.Packages) == 0 {
cmdr.Info.Println(apx.Trans("stacks.update.info.noPackages") + "[y/N]")
} else {
Expand Down
6 changes: 3 additions & 3 deletions locales/ar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ pkgmanagers:
askCommand: "أدخل الامر لأجل '%s':"
askOverwrite: "يوجد مدير حزم بنفس الاسم '%s' بالفعل. هل تريد استبداله؟"
options:
assumeYes:
noPrompt:
description: "افرض الإجابة \"نعم\" لكل الاختيارات."
name:
description: "اسم مدير الحزم."
Expand Down Expand Up @@ -249,7 +249,7 @@ stacks:
askPackages: "من فضلك قم بكتابة الحزم المراد تنزيلها في التشكيلة مع فصلها بمسافة:"
success: "تم إنشاء التشكيلة '%s'."
options:
assumeYes:
noPrompt:
description: "افرض الإجابة \"نعم\" لكل الاختيارات."
name:
description: "اسم التشكيلة."
Expand Down Expand Up @@ -277,7 +277,7 @@ stacks:
confirmPackages: هل تريد الموافقة على قائمة الحزم الحالية؟
noPackages: لم تقم بتوفير أي حزم لتثبيتها في التشكيلة. هل تريد إضافة بعضها الآن؟
options:
assumeYes:
noPrompt:
description: "افرض الإجابة \"نعم\" لكل الاختيارات."
name:
description: "اسم التشكيلة."
Expand Down
6 changes: 3 additions & 3 deletions locales/be.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ pkgmanagers:
askCommand: "Увядзіце каманду для «%s»:"
askOverwrite: "Менеджэр пакетаў з назвай «%s» ужо існуе. Перазапісаць?"
options:
assumeYes:
noPrompt:
description: "Выкажам здагадку, што так на ўсе падказкі."
name:
description: "Імя мэнэджэра пакетаў."
Expand Down Expand Up @@ -250,7 +250,7 @@ stacks:
падзеленыя прабелам:"
success: "Створаны стэк \"%s\"."
options:
assumeYes:
noPrompt:
description: "Выкажам здагадку, што так на ўсе падказкі."
name:
description: "Назва стэка."
Expand Down Expand Up @@ -279,7 +279,7 @@ stacks:
noPackages: You have not provided any packages to install in the stack. Do you
want to add some now?
options:
assumeYes:
noPrompt:
description: "Выкажам здагадку, што так на ўсе падказкі."
name:
description: "Назва стэка."
Expand Down
6 changes: 3 additions & 3 deletions locales/ca.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ pkgmanagers:
askCommand: "Introdueix l'ordre per '%s':"
askOverwrite: "Ja existeix un gestor de paquets anomenat '%s'. Vols sobre escriure'l?"
options:
assumeYes:
noPrompt:
description: "Assumir sí a totes les preguntes."
name:
description: "El nom del gestor de paquets."
Expand Down Expand Up @@ -256,7 +256,7 @@ stacks:
per un espai:"
success: "Pila Creada '%s'."
options:
assumeYes:
noPrompt:
description: "Assumir sí a totes les preguntes."
name:
description: "El nom de la pila."
Expand Down Expand Up @@ -285,7 +285,7 @@ stacks:
noPackages: You have not provided any packages to install in the stack. Do you
want to add some now?
options:
assumeYes:
noPrompt:
description: "Assumir sí a totes les preguntes."
name:
description: "El nom de la pila."
Expand Down
6 changes: 3 additions & 3 deletions locales/cs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ pkgmanagers:
askCommand: "Zadejte příkaz pro '%s':"
askOverwrite: "Správce balíčků s názvem '%s' již existuje. Přepsat ho?"
options:
assumeYes:
noPrompt:
description: "Automaticky zadat ano pro všechny dotazy."
name:
description: "Název správce balíčků."
Expand Down Expand Up @@ -252,7 +252,7 @@ stacks:
mezerou:"
success: "Stack '%s' vytvořen."
options:
assumeYes:
noPrompt:
description: "Automaticky zadat ano pro všechny dotazy."
name:
description: "Název stacku."
Expand Down Expand Up @@ -281,7 +281,7 @@ stacks:
noPackages: You have not provided any packages to install in the stack. Do you
want to add some now?
options:
assumeYes:
noPrompt:
description: "Automaticky zadat ano pro všechny dotazy."
name:
description: "Název stacku."
Expand Down
6 changes: 3 additions & 3 deletions locales/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ pkgmanagers:
askOverwrite: "Ein Paketmanager mit dem Namen '%s' existiert bereits. Überschreiben
Sie ihn?"
options:
assumeYes:
noPrompt:
description: "Alle Fragen mit Ja beantworten."
name:
description: "Der Name des Paketmanagers."
Expand Down Expand Up @@ -260,7 +260,7 @@ stacks:
durch ein Leerzeichen getrennt ein:"
success: "Stapel '%s' erstellt."
options:
assumeYes:
noPrompt:
description: "Alle Fragen mit Ja beantworten."
name:
description: "Der Name des Stapels."
Expand Down Expand Up @@ -292,7 +292,7 @@ stacks:
noPackages: Sie haben keine Pakete zur Installation im Stapel angegeben. Möchten
Sie jetzt welche hinzufügen?
options:
assumeYes:
noPrompt:
description: "Alle Fragen mit Ja beantworten."
name:
description: "Der Name des Stapels."
Expand Down
Loading

0 comments on commit c5caf50

Please sign in to comment.