Skip to content

Commit

Permalink
chore: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonnalley committed Jul 24, 2024
1 parent 9aa5ae9 commit 501c4e9
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,30 @@ $ ts-node myscript.ts
...files in current dir...
```

You can also use oclif's `Parser` separately:

```javascript
// index.js
import {Args, Flags, Parser} from '@oclif/core'

const {args, flags} = await Parser.parse(process.argv.slice(2), {
args: {
name: Args.string({required: true}),
},
flags: {
from: Flags.string({char: 'f', default: 'oclif'}),
},
})

console.log(`hello ${args.name} from ${flags.form}`)
```

```
$ node index.js world --from oclif
hello world from oclif
```

🚀 Contributing

See the [contributing guide](./CONRTIBUTING.md).

0 comments on commit 501c4e9

Please sign in to comment.