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

version bump and verbose flag

parent b818940b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ func TestCLICommandsExposeExpectedFlags(t *testing.T) {
		"bundles-remove": {"directory"},
		"feed":           {"directory", "verbose"},
		"sync":           {"directory"},
		"basex":          {"directory"},
		"basex":          {"directory", "verbose"},
		"templates-list": {"directory"},
		"static-list":    {"directory"},
		"projects":       {"json-out"},
+2 −0
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ commandes new, projects et cache-clear qui peuvent être lancées aussi en dehor
		"flag.freeze.output":        "Dossier de sortie des fichiers HTML",
		"flag.freeze.debug":         "Debug",
		"flag.feed.verbose":         "Afficher les commandes exécutées",
		"flag.basex.verbose":        "Afficher la commande exécutée",
		"flag.projects.json_out":    "Sortie JSON",

		"table.info.name":           "Nom",
@@ -165,6 +166,7 @@ which can also be run outside a MaX directory.`,
		"flag.freeze.output":        "Output directory for HTML files",
		"flag.freeze.debug":         "Debug",
		"flag.feed.verbose":         "Show executed commands",
		"flag.basex.verbose":        "Show executed command",
		"flag.projects.json_out":    "JSON output",

		"table.info.name":           "Name",
+8 −3
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ import (
//go:embed max_releases.json
var fallbackReleases []byte

const version = "0.3.0"
const version = "0.3.1"

const maxConfigFile = "config.xml"
const baseXDistro = "https://files.basex.org/releases/11.7/BaseX117.zip"
@@ -448,14 +448,16 @@ func newSyncCmd() *cobra.Command {

func newBasexCmd() *cobra.Command {
	directory := cwd()
	verbose := false
	cmd := &cobra.Command{
		Use:   "basex",
		Short: T("cmd.basex.short"),
		RunE: func(cmd *cobra.Command, args []string) error {
			return runBasex(directory)
			return runBasex(directory, verbose)
		},
	}
	cmd.Flags().StringVar(&directory, "directory", directory, T("flag.common.directory"))
	cmd.Flags().BoolVar(&verbose, "verbose", false, T("flag.basex.verbose"))
	return cmd
}

@@ -2355,7 +2357,7 @@ func runSync(directory string) error {
	return errors.New(T("err.no_max_use_new"))
}

func runBasex(directory string) error {
func runBasex(directory string, verbose bool) error {
	abs, err := filepath.Abs(directory)
	if err != nil {
		return err
@@ -2374,6 +2376,9 @@ func runBasex(directory string) error {
	cmd.Stdout = os.Stdout
	cmd.Stderr = os.Stderr
	cmd.Stdin = os.Stdin
	if verbose {
		fmt.Println(formatCommand(cmd))
	}
	return cmd.Run()
}