StackStorm / StackStorm/st2

Add parameter to local/remote shell runner to change delimiter in named parameters

Open
#2,387 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
6.5k
Forks
787
PR merge metrics
No merged PRs in 30d

Description

While assisting some users today, I ran into a problem with optparse. In a nutshell, parsing options is hard in Bash, so there are many tendencies to shortcut. One such example:

while [ -n "$1" ]; do
    case $1 in
        -C|--gecos)    gecos=$2;  shift 2;;
        -e|--email)    email=$2;  shift 2;;
        -u|--userid)   userid=$2; shift 2;;
        -d|--dry-run)  dryrun=1;  shift;;
        -h|--help)     usage;;
        *) shift;;
    esac
done

Today, I can change the kwargs_op to any prefix I so desire. But, in all cases, the input is distilled to a dict, and then rendered as key-value pairs. (e.g.: --email=james@fryman.io). This causes a failure with the above logic.

This is not an uncommon pattern, and it would be good to be able to s/=/ / in the above parameter.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names kwargs_op and the local/remote shell runner; start by locating where named parameters are converted from a dict into rendered key-value arguments. Check how the current equals delimiter is applied and make the delimiter configurable, including space-separated arguments for Bash case patterns. Confirm that existing equals-separated behavior still works.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash, python
Domain
backend, devops
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.