Settings

Theme

Show HN: Bash-my-AWS adds `bmai <missing command>` to generate functions

github.com

3 points by mike-bailey a year ago · 3 comments · 1 min read

Reader

Maintaining a popular open source project will get easier with AI to assist. The `bmai` command works a bit like the `bma` command except it generates the function using an LLM (via Simon Willison's llm tool.

mdaniel a year ago

Surely a repo dedicated to bash would know not to use $@ without its quotes :-( https://github.com/bash-my-aws/bash-my-aws/blob/e5cdae316084...

Have they not heard of shellcheck?

  • mike-baileyOP a year ago

    The __bma_read_filters function is designed to take all arguments and join them with | to create a grep pattern. Adding quotes around $@ would break this functionality because:

    __bma_read_filters "arg1 arg2" arg3

    With unquoted $@:

    • Gets word split into: arg1 arg2 arg3 • Results in: arg1|arg2|arg3

    With quoted "$@":

    • Would be passed as: "arg1 arg2" arg3 • Results in: "arg1 arg2"|arg3

    The unquoted version is correct here since the function is intentionally using word splitting to create individual grep pattern elements.

    This is one of those cases where the normal "always quote your variables" rule has a valid exception because word splitting is part of the intended behavior.

mike-baileyOP a year ago

Last time BMA was on front page of HN was 1 Jan 2020 (for about 23 hours IIRC).

https://news.ycombinator.com/item?id=21921293

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection