Skip to content

Commit

Permalink
Fix missing format completion in cb list
Browse files Browse the repository at this point in the history
  • Loading branch information
ngaumont committed May 14, 2024
1 parent b5ce6f8 commit f92ca45
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
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 { |format| format.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

0 comments on commit f92ca45

Please sign in to comment.