Skip to content

Commit

Permalink
Export count as a variable when running commands (#1187)
Browse files Browse the repository at this point in the history
  • Loading branch information
joelim-work committed Apr 1, 2023
1 parent f563263 commit 3ae67fc
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ The following environment variables are exported for shell commands:
lf_user_{option}
lf_width
lf_height
lf_count
The following special shell commands are used to customize the behavior of lf when defined:
Expand Down Expand Up @@ -959,6 +960,10 @@ Value of the user_{option}.
Width/Height of the terminal.
lf_count
Value of the count associated with the current command.
# Special Commands
This section shows information about special shell commands.
Expand Down
5 changes: 5 additions & 0 deletions docstring.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions eval.go
Original file line number Diff line number Diff line change
Expand Up @@ -1263,6 +1263,8 @@ func insert(app *app, arg string) {
}

func (e *callExpr) eval(app *app, args []string) {
os.Setenv("lf_count", strconv.Itoa(e.count))

switch e.name {
case "up":
if !app.nav.init {
Expand Down
7 changes: 7 additions & 0 deletions lf.1
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ The following environment variables are exported for shell commands:
lf_user_{option}
lf_width
lf_height
lf_count
.EE
.PP
The following special shell commands are used to customize the behavior of lf when defined:
Expand Down Expand Up @@ -1167,6 +1168,12 @@ Value of the user_{option}.
.EE
.PP
Width/Height of the terminal.
.PP
.EX
lf_count
.EE
.PP
Value of the count associated with the current command.
.SH SPECIAL COMMANDS
This section shows information about special shell commands.
.PP
Expand Down

0 comments on commit 3ae67fc

Please sign in to comment.