Comments (6)
Hey @umbopepato,
in v0.9.0 is now a new way to resolve your issue. You can use .stopEarly() instead of .useRawArgs()
. If stopEarly
is enabled, all arguments, starting from the first non option argument, will be interpreted as raw argument.
In contrast to .useRawArgs()
the --help
and --version
option will still work.
from deno-cliffy.
Hi @umbopepato,
There is an undocumented method useRawArgs()
which you can try to use. But it is not fully tested. useRawArgs()
disables the parsing and validation of all arguments for the command on which it was called.
Here is an example:
import { Command } from 'https://deno.land/x/[email protected]/command.ts';
await new Command()
.command('mysubcmd [myarg] [otherArgs...]')
.useRawArgs()
.action((options, ...args) => {
console.log(options, args);
})
.parse(Deno.args);
$ deno run raw-args.ts mysubcmd myarg other args and --options
{} [ "myarg", "other", "args", "and", "--options" ]
from deno-cliffy.
Another way could be to use literal arguments:
mycmd --myoption mysubcmd myarg -- other args and --options
^--
All arguments after --
will be ignored by cliffy. But at the moment the literal argument will not be passed to the action handler or returned by the .parse()
method. I have already an issue for that #26. So you have to access Deno.args by your self to get them atm.
from deno-cliffy.
I was literally going to ask you if something like useRawArgs()
existed, that's perfect! Also because I'm explicitly trying to avoid the --
separator.
Thanks @c4spar 🙂
from deno-cliffy.
np 🙂
from deno-cliffy.
Awesome! Thank you @c4spar
from deno-cliffy.
Related Issues (20)
- ANSI codes overflow multi-line table cells
- Feedback on grouped select prompt HOT 1
- Allow for dynamic Select options
- Empty strings are parsed as arguments regardless of context HOT 1
- feature request: return output from action handler
- Can I read option as argument? HOT 1
- generated zsh completions doesn't seem to be able to tab-complete files. HOT 4
- Warnings about Deno.stdin in v1.40.1 HOT 7
- Prefill and edit prompt? HOT 1
- Is the project alive ? HOT 2
- Docs: JSDoc example for `Command#arguments` method shows wrong syntax in intellisense
- Not available on jsr.io HOT 7
- TypeError: Cannot read properties of undefined (reading 'icon') HOT 2
- `files` option fails if user inputs `~/`
- Disable colors if the standard output is not a TTY
- Support automatic zsh completions with fpath
- variadic args prevent any subsequent options HOT 1
- wrong return type of Checkbox.prompt
- Upgrade check fails for JSR provider if only pre-releases exist
- Add option to configure help width
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 deno-cliffy.