Skip to content

Allow flags to precede required positional arguments #124

@DannyBen

Description

@DannyBen

Some users expect to be able to run cli --arg param required_arg in addition to the currently supported cli required_arg --arg param.

Any reasonable solution will probably require changing the serial filters here:

https://github.com/DannyBen/bashly/blob/e8804a9259ad04c61113b833223aa6fd67a776ef/lib/bashly/views/command/parse_requirements.erb#L11-L13

so that they just work together as one, probably something like this:

  1. Go through each argument in the command line
  2. If it is a --flag, add it to the ${args[--flag]} array
  3. If it is an arg, add it to the ${args[arg]} array, where the arg name is shifted from the full args list.
  4. After all that is done, add a single filter that just checks that both required args and flags are present, and abort if not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions