Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/euhmeuh/command-tree
A Racket package to handle tree-style (à la git) command line arguments
https://github.com/euhmeuh/command-tree
Last synced: 6 days ago
JSON representation
A Racket package to handle tree-style (à la git) command line arguments
- Host: GitHub
- URL: https://github.com/euhmeuh/command-tree
- Owner: euhmeuh
- License: lgpl-3.0
- Created: 2018-01-05T13:06:28.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-03-20T13:37:32.000Z (almost 7 years ago)
- Last Synced: 2024-11-18T14:39:36.983Z (2 months ago)
- Language: Racket
- Size: 7.81 KB
- Stars: 3
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# command-tree
A Racket package to handle tree-style (à la git) command line arguments## Examples
This package allows you to write command line applications that behaves like this:
`$ git stash pop`
`$ pimp my ride "green neons"`
`$ ipod list all albums from 1969`
`$ hello world --help`
# Install
`raco pkg install command-tree`
# Usage
```racket
#lang racket/base(require command-tree)
;; ... define procedures git-clone, git-init, git-stash-apply...
;; write your available commands in a tree
(define git-commands
`([clone ,git-clone]
[init ,git-init]
[push ,git-push]
[remote (add ,git-remote-add)
(rename ,git-remote-rename)
(remove ,git-remote-remove)]
[stash (list ,git-stash-list)
(show ,git-stash-show)
(drop ,git-stash-drop)
(pop ,git-stash-pop)
(apply ,git-stash-apply)]));; use the tree to parse the command line
(command-tree git-commands (current-command-line-arguments))
```See the test submodule in main.rkt for a complete usage example.