shargs-example-sync-sql is a sample application of shargs 🦈.
See the shargs github repository for more details!
$ git clone https://github.com/Yord/shargs-example-sync-sql.git
$ cd shargs-example-sync-sql
$ npm i
$ chmod +x ./sqlThis repository is a simple example of a command-line parser build with shargs.
The program can be found in the sql script.
The sql script parses a very simple version of the SQL query language:
./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 10This prints the following:
{
_: [],
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.
Please report issues in the shargs tracker!
shargs-example-sync-sql is MIT licensed.