https://github.com/yord/shargs-example-sync-sql
shargs-example-sync-sql is a sample application of shargs 🦈.
https://github.com/yord/shargs-example-sync-sql
command-line parser shargs
Last synced: 8 months ago
JSON representation
shargs-example-sync-sql is a sample application of shargs 🦈.
- Host: GitHub
- URL: https://github.com/yord/shargs-example-sync-sql
- Owner: Yord
- License: mit
- Created: 2020-07-13T11:52:30.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T11:22:46.000Z (over 3 years ago)
- Last Synced: 2025-06-19T17:08:17.587Z (about 1 year ago)
- Topics: command-line, parser, shargs
- Language: JavaScript
- Homepage:
- Size: 551 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
shargs-example-sync-sql is a sample application of [shargs][shargs] 🦈.
See the [`shargs` github repository][shargs] for more details!
[![node version][shield-node]][node]
[![license][shield-license]][license]
[![PRs Welcome][shield-prs]][contribute]
## Setup
```bash
$ git clone https://github.com/Yord/shargs-example-sync-sql.git
$ cd shargs-example-sync-sql
$ npm i
$ chmod +x ./sql
```
## Example
This repository is a simple example of a command-line parser build with [shargs][shargs].
The program can be found in the [`sql`][sql] script.
## Run the Example
The `sql` script parses a very simple version of the SQL query language:
```bash
./sql \
SELECT 'alias, power' \
FROM superheroes,powers \
WHERE 'id = superhero_id AND universe = "Marvel"' \
GROUP BY alias \
HAVING 'COUNT(power) > 5' \
ORDER BY alias \
LIMIT 10
```
This prints the following:
```js
{
_: [],
select: [ 'alias', 'power' ],
from: [ 'superheroes', 'powers' ],
where: 'id = superhero_id AND universe = "Marvel"',
groupBy: 'alias',
having: 'COUNT(power) > 5',
orderBy: 'alias',
limit: 10
}
```
Note that the order of the object fields may be different depending on the node version.
## Reporting Issues
Please report issues [in the `shargs` tracker][issues]!
## License
`shargs-example-sync-sql` is [MIT licensed][license].
[contribute]: https://github.com/Yord/shargs#contributing
[issues]: https://github.com/Yord/shargs/issues
[license]: https://github.com/Yord/shargs-example-sync-sql/blob/master/LICENSE
[node]: https://nodejs.org/
[shargs]: https://github.com/Yord/shargs
[shield-license]: https://img.shields.io/badge/license-MIT-yellow.svg?labelColor=313A42
[shield-node]: https://img.shields.io/node/v/shargs?color=red&labelColor=313A42
[shield-prs]: https://img.shields.io/badge/PRs-welcome-green.svg?labelColor=313A42
[sql]: https://github.com/Yord/shargs-example-sync-sql/blob/master/sql