Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow setting the prompt via a commandline flag. #149

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (cmd *Cmd) Main(args []string) (err error) {
g := &ir.Comp.Globals

var set, clear Options
var repl, forcerepl = true, false
repl, forcerepl := true, false
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(This was my editor auto-fixing things. I can revert if you'd like.)

cmd.WriteDeclsAndStmts = false
cmd.OverwriteFiles = false

Expand Down Expand Up @@ -115,6 +115,11 @@ func (cmd *Cmd) Main(args []string) (err error) {
case "-t", "--trap":
set |= OptTrapPanic | OptPanicStackTrace
clear &= OptTrapPanic | OptPanicStackTrace
case "-p", "--prompt":
if len(args) > 1 {
ir.Comp.Prompt = args[1]
args = args[1:]
}
case "-s", "--silent":
set &^= OptShowPrompt | OptShowEval | OptShowEvalType
clear |= OptShowPrompt | OptShowEval | OptShowEvalType
Expand Down Expand Up @@ -172,6 +177,7 @@ func (cmd *Cmd) Usage() error {
useful to run gomacro as a Go preprocessor
-n, --no-trap do not trap panics in the interpreter
-t, --trap trap panics in the interpreter (default)
-p, --prompt [PROMPT] replace the default prompt with this string
-s, --silent silent. do NOT show startup message, prompt, and expressions results.
default when executing files and dirs.
-v, --verbose verbose. show startup message, prompt, and expressions results.
Expand Down