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

Fix missing format completion in cb list #167

Merged
merged 1 commit into from
May 17, 2024
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed
- `cb list` completion to include `--format`.

## [3.5.1] - 2024-05-09
### Fixed
- `cb config-param set` issue truncating values with multiple `=` characters.
Expand Down
5 changes: 3 additions & 2 deletions spec/cb/completion_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -379,12 +379,13 @@ Spectator.describe CB::Completion do
it "list" do
result = parse("cb list ")
expect(result).to have_option "--team"
expect(result).to have_option "--format"

result = parse("cb list --team ")
expect(result).to eq expected_team_suggestion

result = parse("cb list --team abc ")
expect(result).to eq [] of String
result = parse("cb list --format ")
expect(result).to eq ["table", "tree"]
end

it "logdest" do
Expand Down
5 changes: 5 additions & 0 deletions src/cb/completion.cr
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,13 @@ class CB::Completion
return team_suggestions
end

if last_arg?("--format")
return [CB::Format::Table, CB::Format::Tree].map(&.to_s.downcase)
end

suggest = [] of String
suggest << "--team\tteam id" unless has_full_flag? :team
suggest << "--format\tchoose output format" unless has_full_flag? :format
suggest
end

Expand Down