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

Add stdin option to command chains #190

Closed
LucasPickering opened this issue Apr 30, 2024 · 0 comments · Fixed by #198
Closed

Add stdin option to command chains #190

LucasPickering opened this issue Apr 30, 2024 · 0 comments · Fixed by #198
Labels
good first issue Good for newcomers qol Improvements that make usage smoother, without introducing new functionality

Comments

@LucasPickering
Copy link
Owner

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Right now, it's tedious to write command chains that require stdin input. For example:

chains:
  email-body:
    source: !request
      recipe: get-email
    selector: $.headers
  email-body-escaped:
    source: !command
      command: [sh, -c, "echo '{{chains.email-body}}' | jq -R -s '.'"]

The goal here is to reduce the number of use cases where users have to invoke the shell, without too much effort (see #153 for another example). This has two benefits:

  • More user friendly
  • Reduce cross-platform issues

Describe the solution you'd like
A clear and concise description of what you want to happen

A new field stdin on the !command variant:

chains:
  email-body:
    source: !request
      recipe: get-email
    selector: $.headers
  email-body-escaped:
    source: !command
      command: [jq, -R, -s, '.']
      stdin: "{{chains.email-body}}"

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered

The primary alternative is doing nothing, since this is already possible by invoking the shell directly.

Additional context
Add any other context or screenshots about the feature request here

If anyone wants to implement this, the work involved is:

@LucasPickering LucasPickering added good first issue Good for newcomers qol Improvements that make usage smoother, without introducing new functionality labels Apr 30, 2024
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue May 6, 2024
[1.1.0] - 2024-05-05

Added
- Add `section` field to `!request` chain values, to allow chaining response headers rather than body ([#184](LucasPickering/slumber#184))
- Add action to save response body to file ([#183](LucasPickering/slumber#183))
- Add `theme` field to the config, to configure colors ([#193](LucasPickering/slumber#193))
  - [See docs](https://slumber.lucaspickering.me/book/api/configuration/theme.html) for more info
- Add `stdin` option to command chains ([#190](LucasPickering/slumber#190))

Changed
- Reduce UI latency under certain scenarios
  - Previously some actions would feel laggy because of an inherent 250ms delay in processing some events
- Search parent directories for collection file ([#194](LucasPickering/slumber#194))
- Use thicker borders for selected pane and modals
- Change default TUI colors to blue and yellow

Fixed
- Fix Slumber going into zombie mode and CPU spiking to 100% under certain closure scenarios ([#136](LucasPickering/slumber#136))
- Fix historical request/response no loading on first render ([#199](LucasPickering/slumber#199))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers qol Improvements that make usage smoother, without introducing new functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant