Skip to content

Commit

Permalink
Better on-line help for auxents and terminals
Browse files Browse the repository at this point in the history
  • Loading branch information
johnkerl committed May 15, 2023
1 parent 145a25e commit b822ff0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions internal/pkg/auxents/auxents.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ func auxListMain(args []string) int {

// ShowAuxEntries is a symbol is exported for 'mlr --help'.
func ShowAuxEntries(o *os.File) {
fmt.Fprintf(o, "Available subcommands:\n")
fmt.Fprintf(o, "Available entries:\n")
for _, entry := range _AUX_LOOKUP_TABLE {
fmt.Fprintf(o, " %s\n", entry.name)
fmt.Fprintf(o, " mlr %s\n", entry.name)
}

fmt.Fprintf(o, "For more information, please invoke mlr {subcommand} --help.\n")
Expand Down
7 changes: 5 additions & 2 deletions internal/pkg/terminals/help/entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

"github.com/mattn/go-isatty"

"github.com/johnkerl/miller/internal/pkg/auxents"
"github.com/johnkerl/miller/internal/pkg/bifs"
"github.com/johnkerl/miller/internal/pkg/cli"
"github.com/johnkerl/miller/internal/pkg/dsl/cst"
Expand Down Expand Up @@ -325,12 +326,14 @@ func listSeparatorRegexAliases() {
func helpAuxents() {
fmt.Print(`Miller has a few otherwise-standalone executables packaged within it.
They do not participate in any other parts of Miller.
Please "mlr aux-list" for more information.
`)
fmt.Println()
auxents.ShowAuxEntries(os.Stdout)
}

func helpTerminals() {
fmt.Println("Terminals include on-line help, regression-test entry point, and the REPL.")
fmt.Println("Terminals include mlr help, the regression-test entry point mlr regtest, and the REPL mlr repl.")
// We can't invoke the terminal-lister since that would create a cyclic package reference.
}

// ----------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions internal/pkg/terminals/repl/entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,14 @@ func ReplMain(args []string) int {

err = repl.handleSession(os.Stdin)
if err != nil {
fmt.Fprintf(os.Stderr, "mlr s: %v", repl.replName, err)
fmt.Fprintf(os.Stderr, "mlr %s: %v", repl.replName, err)
os.Exit(1)
}

repl.bufferedRecordOutputStream.Flush()
err = repl.closeBufferedOutputStream()
if err != nil {
fmt.Fprintf(os.Stderr, "mlr s: %v", repl.replName, err)
fmt.Fprintf(os.Stderr, "mlr %s: %v", repl.replName, err)
os.Exit(1)
}
return 0
Expand Down

0 comments on commit b822ff0

Please sign in to comment.