Skip to content

Commit

Permalink
pkg/shell: Add -l as a no-op flag.
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaq committed Jul 22, 2024
1 parent d5bfaf2 commit df3efaf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pkg/shell/shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,12 @@ type Program struct {
}

func (p *Program) RegisterFlags(fs *prog.FlagSet) {
// Support -i so that programs that expect shells to support it (like
// "script") don't error when they invoke Elvish.
// script(1) (and possibly other programs) assume shells support -i
fs.Bool("i", false,
"A no-op flag, introduced for POSIX compatibility")
"A no-op flag, introduced for compatibility")
// termux (and possibly other programs) assume shells support -l
fs.Bool("l", false,
"A no-op flag, introduced for compatibility")
fs.BoolVar(&p.codeInArg, "c", false,
"Treat the first argument as code to execute")
fs.BoolVar(&p.compileOnly, "compileonly", false,
Expand Down
7 changes: 7 additions & 0 deletions pkg/shell/shell_test.elvts
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
//each:elvish-in-global

///////////////
# no-op flags #
///////////////

~> elvish -i -l -c 'echo hello'
hello

/////////////////////
# XDG library paths #
/////////////////////
Expand Down

0 comments on commit df3efaf

Please sign in to comment.