Commit e0492882 authored by Mickaël Desfrênes's avatar Mickaël Desfrênes
Browse files

add help for chooseBetween prompts

parent 06f3b3a6
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -107,6 +107,7 @@ Si le bundle ajouté est un bundle de vocabulaire, il devient le bundle de vocab
		"msg.demo_hint":             "Vous pouvez démarrer MaX avec la commande climax start",
		"msg.starting_max":          "Démarrage de MaX sur http://%s:%d (stop port: %d)",
		"msg.site_copied":           "Site copié dans %s",
		"msg.choose_hint":           "Saisissez le numéro de ligne ou la valeur.",
		"msg.choose_invalid":        "Choix invalide, veuillez réessayer.",
		"msg.value_not_empty":       "La valeur ne peut pas être vide.",
		"msg.directory_already_max": "Le dossier contient une instance de MaX. Utilisez la commande sync",
@@ -246,6 +247,7 @@ If the added bundle is a vocabulary bundle, it becomes the project's vocabulary
		"msg.demo_hint":             "You can start MaX with the command climax start",
		"msg.starting_max":          "Starting MaX on http://%s:%d (stop port: %d)",
		"msg.site_copied":           "Site copied to %s",
		"msg.choose_hint":           "Enter the line number or the value.",
		"msg.choose_invalid":        "Invalid choice, please try again.",
		"msg.value_not_empty":       "Value cannot be empty.",
		"msg.directory_already_max": "Directory already contains a MaX instance. Use the sync command.",
+1 −1
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ import (
//go:embed max_releases.json
var fallbackReleases []byte

const version = "0.6.1"
const version = "0.6.2"

const maxConfigFile = "config.xml"
const minSupportedMaxVersion = "0.0.5"
+23 −0
Original line number Diff line number Diff line
@@ -1173,6 +1173,29 @@ func TestBundleTEIPackageIsVocabularyBundle(t *testing.T) {
	}
}

func TestChooseBetweenShowsLineNumberOrValueHint(t *testing.T) {
	previousLocale := currentLocale
	setLocale(localeEN)
	t.Cleanup(func() {
		setLocale(previousLocale)
	})

	withStdinContent(t, "second\n", func() {
		out := captureStdoutForMainTest(t, func() {
			selected, err := chooseBetween([]string{"first", "second"}, "Pick one")
			if err != nil {
				t.Fatalf("chooseBetween failed: %v", err)
			}
			if selected != "second" {
				t.Fatalf("expected selected value second, got %q", selected)
			}
		})
		if !strings.Contains(out, "Enter the line number or the value.") {
			t.Fatalf("expected line-number-or-value hint, got:\n%s", out)
		}
	})
}

func TestBundlesAddVocabularyBundleRemovesPreviousVocabularyBundle(t *testing.T) {
	projectDir := newMinimalSyncedMaxProject(t)
	dotMaxDir := filepath.Join(projectDir, ".max")
+1 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ func chooseBetween(values []string, label string) (string, error) {
	for i, v := range values {
		fmt.Printf("  %d) %s\n", i+1, v)
	}
	fmt.Println(T("msg.choose_hint"))

	for {
		answer, err := prompt(T("label.choice"))