ManageIQ / ManageIQ/awesome_spawn
[RFE] Better params ergonomics
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 9
- Forks
- 14
- PR merge metrics
- No merged PRs in 30d
Description
A typical command is currently:
```ruby
AwesomeSpawn.run!("ls", :params => [:a, :l])
```
Most times, params are needed (because sanitizing them is the point of using AwesomeSpawn, otherwise you'd probably just use backticks). But that params key is clunky.
Additionally, the params key is _not_ passed to AwesomeSpawn.build_command_line
```ruby
AwesomeSpawn.build_command_line("ls", [:a, :l])
# => "ls -a -l"
```
As such, I propose we drop the params key altogether, and make it part of the "command" portion via Array or Hash. So, I could see one or all of
```ruby
AwesomeSpawn.run!("ls" => [:a, :l])
AwesomeSpawn.run!(["ls", [:a, :l]])
AwesomeSpawn.run!("ls", [:a, :l])
```
I kind of like the first one, and the second one is just an associative array version of the first (i.e. it's the same as `.to_a`), so it's straightfoward to implement.
Then, we should make `build_command_line` have the exact same interface.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the existing interfaces for AwesomeSpawn.run! and AwesomeSpawn.build_command_line, including how the current params option is handled. Resolve which command/params form is supported and make both entry points share it, with command construction and parameter passing behaving consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100