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

Export count as a variable when running commands #1187

Merged
merged 1 commit into from
Apr 1, 2023
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,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 @@ -954,6 +955,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 @@ -1261,6 +1261,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 @@ -206,6 +206,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 @@ -1160,6 +1161,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