Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions doc/rush-menu.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
.\" Automatically generated by Pandoc 3.9
.\"
.TH "rush\-menu" "1" "July 2026" "" "Select a package from an interactive menu."
.SH NAME
\f[B]rush menu\f[R] \- Select a package from an interactive menu.
.SH SYNOPSIS
\f[B]rush menu\f[R] REPO_OR_PACKAGE OPTIONS
.SH DESCRIPTION
Select a package from an interactive menu.
.SH ARGUMENTS
.SS REPO_OR_PACKAGE
Repository name or package name.
.PP
Leave blank to show all packages in all repositories.
.PP
Provide a repository name to show only packages in this repository.
.PP
Provide a package name (may be in the form of \f[B]repo:package\f[R]) to
show nested packages.
.SH OPTIONS
.SS \-\-install, \-i
Install the selected package instead of showing its info.
.SH DEPENDENCIES
.SS fzf
.SH EXAMPLES
.IP
.EX
rush menu

rush menu \-\-install

rush menu personal
.EE
.SH SEE ALSO
\f[B]rush\f[R](1)
69 changes: 69 additions & 0 deletions doc/rush-menu.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
% rush-menu(1) | Select a package from an interactive menu.
%
% July 2026

NAME
==================================================

**rush menu** - Select a package from an interactive menu.

SYNOPSIS
==================================================

**rush menu** [REPO_OR_PACKAGE] [OPTIONS]

DESCRIPTION
==================================================

Select a package from an interactive menu.


ARGUMENTS
==================================================

REPO_OR_PACKAGE
--------------------------------------------------

Repository name or package name.

Leave blank to show all packages in all repositories.

Provide a repository name to show only packages in this repository.

Provide a package name (may be in the form of **repo:package**) to show nested packages.


OPTIONS
==================================================

--install, -i
--------------------------------------------------

Install the selected package instead of showing its info.


DEPENDENCIES
==================================================

fzf
--------------------------------------------------


EXAMPLES
==================================================

~~~
rush menu

rush menu --install

rush menu personal

~~~

SEE ALSO
==================================================

**rush**(1)


8 changes: 5 additions & 3 deletions doc/rush.1
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ Copy a package between local repositories.
Show information about a package.
.SS rush list
Show packages in one or all repositories.
.SS rush menu
Select a package from an interactive menu.
.SS rush search
Search in package names and info files.
.SS rush edit
Expand All @@ -62,9 +64,9 @@ Default: \(ti/rush\-repos
\f[B]rush\-default\f[R](1), \f[B]rush\-get\f[R](1),
\f[B]rush\-undo\f[R](1), \f[B]rush\-snatch\f[R](1),
\f[B]rush\-copy\f[R](1), \f[B]rush\-info\f[R](1),
\f[B]rush\-list\f[R](1), \f[B]rush\-search\f[R](1),
\f[B]rush\-edit\f[R](1), \f[B]rush\-show\f[R](1),
\f[B]rush\-completions\f[R](1)
\f[B]rush\-list\f[R](1), \f[B]rush\-menu\f[R](1),
\f[B]rush\-search\f[R](1), \f[B]rush\-edit\f[R](1),
\f[B]rush\-show\f[R](1), \f[B]rush\-completions\f[R](1)
.SH SOURCE CODE
https://github.com/dannyben/rush
.SH ISSUE TRACKER
Expand Down
7 changes: 6 additions & 1 deletion doc/rush.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ rush list

Show packages in one or all repositories.

rush menu
--------------------------------------------------

Select a package from an interactive menu.

rush search
--------------------------------------------------

Expand Down Expand Up @@ -145,7 +150,7 @@ Default: ~/rush-repos
SEE ALSO
==================================================

**rush-add**(1), **rush-remove**(1), **rush-clone**(1), **rush-pull**(1), **rush-push**(1), **rush-config**(1), **rush-default**(1), **rush-get**(1), **rush-undo**(1), **rush-snatch**(1), **rush-copy**(1), **rush-info**(1), **rush-list**(1), **rush-search**(1), **rush-edit**(1), **rush-show**(1), **rush-completions**(1)
**rush-add**(1), **rush-remove**(1), **rush-clone**(1), **rush-pull**(1), **rush-push**(1), **rush-config**(1), **rush-default**(1), **rush-get**(1), **rush-undo**(1), **rush-snatch**(1), **rush-copy**(1), **rush-info**(1), **rush-list**(1), **rush-menu**(1), **rush-search**(1), **rush-edit**(1), **rush-show**(1), **rush-completions**(1)

# SOURCE CODE

Expand Down
18 changes: 18 additions & 0 deletions features/fixtures/bin/fzf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
selection=${STUB_FZF_SELECTION:-hello}
input=$(cat)

if [[ ${STUB_FZF_INPUT-} ]]; then
printf "%s\n" "$input" >"$STUB_FZF_INPUT"
fi

while IFS= read -r line; do
package=${line%%[[:space:]]*}

if [[ $package == "$selection" ]]; then
printf "%s\n" "$line"
exit 0
fi
done <<<"$input"

exit 1
1 change: 0 additions & 1 deletion features/list.feature
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ Scenario: Show package names only
bootstrap
download
hello
nested
"""

Scenario: Show nested packages for a package name
Expand Down
46 changes: 46 additions & 0 deletions features/menu.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
Feature: menu
Show packages in one or all repositories using fzf interactive menu

Scenario: Show --help
When I run 'rush menu --help'
Then the exit code should mean success
And stdout should include 'Select a package from an interactive menu'
And stdout should include '--install, -i'

Scenario: Show packages in the default repository
Given rush is properly configured
And the command 'fzf' is stubbed
And my fzf selection will be 'hello'
When I run 'rush menu'
Then the fzf menu should show
"""
▌ package-in-package/two Package two
▌ package-in-package/one Package one
▌ nested/hi Shows how to use nested folders
▌ hello This is a simple example.
▌ download Shows how a script can copy files from its own folder
▌ bootstrap Shows how to run another command from the same reposi·
"""
And the exit code should mean success
And stdout should include 'This info file can be accessed by running'

Scenario: Show packages in the a nested package
Given rush is properly configured
And the command 'fzf' is stubbed
And my fzf selection will be 'nested/hi'
When I run 'rush menu nested'
Then the fzf menu should show
"""
▌ nested/hi Shows how to use nested folders
"""
Then the exit code should mean success
And stdout should include '$ rush info nested/hi'

Scenario: Install package
Given rush is properly configured
And the command 'fzf' is stubbed
And my fzf selection will be 'hello'
When I run 'rush menu --install'
Then the exit code should mean success
And stdout should include 'What's the rush'
And stdout should include 'REPO: default'
13 changes: 13 additions & 0 deletions features/step_definitions/stubbing.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,15 @@
@Given the command '{command}' is stubbed
install_stubbed_command "$command"

@Given my fzf selection will be '{selection}'
export STUB_FZF_INPUT="$TMPDIR/fzf-input"
export STUB_FZF_SELECTION="$selection"
defer unset STUB_FZF_INPUT
defer unset STUB_FZF_SELECTION

@Then the fzf menu should show
[[ -f "$STUB_FZF_INPUT" ]] || fail "fzf input was not captured"

actual=$(fzf_menu_display "$STUB_FZF_INPUT")

[[ "$actual" == "$DOC_STRING" ]] || fail "expected fzf menu to show:\n$DOC_STRING\n\ngot:\n$actual"
17 changes: 16 additions & 1 deletion features/support.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@ stub_fixture_root() {
printf '%s\n' "$SUPPORT_PROJECT_ROOT/features/fixtures/bin"
}

fzf_menu_display() {
tac "$1" |
while IFS= read -r line; do
if ((${#line} > 75)); then
line="${line:0:75}·"
fi

printf "▌ %s\n" "$line"
done
}

prepare_isolated_environment() {
local old_pwd="$PWD"
local old_home="${HOME-}"
Expand Down Expand Up @@ -75,7 +86,11 @@ install_stubbed_command() {
stub_root=$(mktemp -d)
stub_path="$stub_root/$command"

[[ -f "$fixture_root/$command" ]] || fail "missing stub fixture: $fixture_root/$command"
if [[ ! -f "$fixture_root/$command" ]]; then
fail "missing stub fixture: $fixture_root/$command"
return
fi

cp "$fixture_root/$command" "$stub_path"
chmod +x "$stub_path"
export PATH="$stub_root:$PATH"
Expand Down
Loading
Loading