Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Idea: --rexec "shell command" option #34

Closed
simonw opened this issue Jun 29, 2023 · 3 comments
Closed

Idea: --rexec "shell command" option #34

simonw opened this issue Jun 29, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@simonw
Copy link
Owner

simonw commented Jun 29, 2023

Inspired by:

symbex fetch_articles -n \
  | llm --system 'add type hints' \
  | symbex fetch_articles --replace

Would be nice if you didn't have to do the -n and the pipes and the duplicate call to symbex there. How about this instead?

symbex fetch_articles --rexec "llm --system 'add type hints'"

Where --rexec stands for "replace with execution".

@simonw simonw added the enhancement New feature or request label Jun 29, 2023
simonw added a commit that referenced this issue Jun 29, 2023
@simonw
Copy link
Owner Author

simonw commented Jun 29, 2023

Prototyped in a branch.

@simonw
Copy link
Owner Author

simonw commented Jun 29, 2023

I was hoping this would work, to avoid having to put single quotes inside double quotes:

symbex is_subpath --rexec -- llm --system 'add type hints and comments' -m 4

But that's not what -- does, apparently. I get this error:

Usage: symbex [OPTIONS] [SYMBOLS]...
Try 'symbex --help' for help.

Error: No such option: --system Did you mean --sys-path?

@simonw
Copy link
Owner Author

simonw commented Jul 16, 2023

--replace already implements a rule that it will only work if there is just a single match:

symbex/symbex/cli.py

Lines 436 to 443 in 2b102a9

if replace:
# Only works if we got a single match
if len(replace_matches) != 1:
raise click.ClickException(
"--replace only works with a single match, got {}".format(
len(replace_matches)
)
)

simonw added a commit that referenced this issue Jul 16, 2023
simonw added a commit that referenced this issue Jul 16, 2023
@simonw simonw closed this as completed in 1537d92 Jul 16, 2023
simonw added a commit that referenced this issue Jul 16, 2023
simonw added a commit that referenced this issue Jul 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant