Comments (1)
No, you need to pass the outer argument with quotes.
This works:
function ytd
youtube-dl -t $argv[1]
end
ytd "https://youtu.be/HPGvrxjT7aY?si=94x7gGDp76rTI4dX"
You need to quote the argument where the string is - the ?
is special, so that needs to be quoted where it is, not later.
That will work but I was hoping to be able to pass the argument without quotes, to have the function add them. Is this possible?
It is not. The argument is expanded before the function ever runs.
You can fiddle something together with abbreviations, which is a lot easier with abbr --command
( #10452):
function quote_arg
string escape -- $argv
end
function ytd
youtube-dl $argv
end
abbr -a --command ytd --function 'quote_arg' --regex '.*' quotearg
(without that you'll have to mess with commandline
to check if it's an argument to ytd
)
But in general, quoting is a fact of life. You cannot ignore quoting, the entire language is based on expansion - if it sees an unquoted $
, it'll try to expand a variable, if it sees an unquoted *
, it'll glob, if it sees an unquoted ;
it'll end the command.
For ?
in particular, we're removing it, and it's removed-by-default in the next release, so urls usually won't have special characters in them anymore.
from fish-shell.
Related Issues (20)
- Fish should expand abbreviations after an `env` command HOT 3
- feature request: support full CSIu kitty keyboard protocol HOT 1
- Test failures pre 3.8.0 HOT 6
- Configure `backward-kill-path-component` to count `-` as a separator? HOT 3
- Add an easy way to retry a command until it succeeds HOT 1
- Undenied permission with brew? HOT 8
- Fish git prompt doesn't show (U)pdated but (U)nmerged changes HOT 2
- No $status even though it's reported it exists HOT 2
- fish_history corrupted with NUL bytes HOT 1
- fish_variables has too large size make fish has a significant delays during startup HOT 1
- Different descriptions of Universal variables in the documentation HOT 1
- Transient prompt doesn't work on recent git master builds
- Terminal protocols spew a *lot* of output
- Android install tutorial in README.md HOT 1
- Alias escaping HOT 1
- Feat: In commands such as `edit_command_buffer` set an environment variable to let the editor config setup custom behaviour HOT 3
- Paging command output as if it was written to a terminal HOT 2
- fish became slow because checking two tools HOT 9
- Not able to `ctrl+c` out of `fzf`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fish-shell.