denisidoro / navi

An interactive cheatsheet tool for the command-line
Apache License 2.0
14.61k stars 489 forks source link

Basic curl cheatsheet doesn't work on zsh due to quoting issues #856

Open brandon-fryslie opened 9 months ago

brandon-fryslie commented 9 months ago

Describe the bug A clear and concise description of what the bug is.

Using the default cheatsheets, the curl examples are broken in zsh for some URLs.

To Reproduce Steps to reproduce the behavior:

  1. Install Navi
  2. Activate via ctrl+g and install 'default cheatsheets' (/pat/to/navi repo add denisidoro/cheats)
  3. Press ctrl+g again and type curl
  4. Choose send a get http request
  5. Paste a URL such as https://github.com/denisidoro/navi/blob/master/docs/installation.md#installing-the-shell-widget into the variable
  6. The resulting command in the terminal will be curl https://github.com/denisidoro/navi/blob/master/docs/installation.md#installing-the-shell-widget
  7. Executing this command fails with the error zsh: no matches found: https://github.com/denisidoro/navi/blob/master/docs/installation.md#installing-the-shell-widget

Expected behavior A clear and concise description of what you expected to happen.

Executing the command curl 'https://github.com/denisidoro/navi/blob/master/docs/installation.md#installing-the-shell-widget' succeeds, so it looks like a quoting issue.

Parameters that contain special characters should be quoted automaticaly.

Screenshots If applicable, add screenshots to help explain your problem.

N/A

Versions:

Additional context Add any other context about the problem here.

This is likely to shell-specific, and might be difficult to implement. However it really limits the usefulness of the tool if we need to manually go back in and add quotes around specific parameters.

welcome[bot] commented 9 months ago

Thanks for opening your first issue here! In case you're facing a bug, please update navi to the latest version first. Maybe the bug is already solved! :)

tjex commented 8 months ago

Are you open to making a pr for this? It would simply be a case of changing the curl.cheat file.

# send a get http request
curl <url>

to

# send a get http request
curl "<url>"

The repo is a community cheat sheet, so prs are welcome.

Putting quotes around the string, will not break the command for other OSs / shells (it's actually better practice). So it's safe to change the cheat sheet globally.