CLI Tools Design
Shintaro Kaneko - @kaneshin / גࣜձࣾΤϨΧ
໊લ ۚࢠ৻ଠ 4IJOUBSP,BOFLP
Do you have experience of creating
Command Line Tools?
We absolutely need to know
The CLI Design
for publishing a great library
Premature optimization is
the root of all evil.
We should forget about small efﬁciencies, say about 97% of the time:
premature optimization is the root of all evil.
Yet we should not pass up our opportunities in that critical 3%.
- Donald Knuth
UNIX Philosophy - Doug McIlroy
This is the Unix philosophy:
1. Write programs that do one thing and do it well.
2. Write programs to work together.
3. Write programs to handle text streams, because that is a universal
UNIX Philosophy - Mike Gancarz
1. Small is beautiful.
2. Make each program do one thing well.
3. Build a prototype as soon as possible.
4. Choose portability over efﬁciency.
5. Store data in ﬂat text ﬁles.
6. Use software leverage to your advantage.
7. Use shell scripts to increase leverage and portability.
8. Avoid captive user interfaces.
9. Make every program a ﬁlter.
Go is based on the philosophy
Command Line Interface
$ exe [GLOBAL OPTIONS]... \
 [COMMAND OPTIONS]... [...]
$ git --git-dir=/path/to/repo/.git \
log --oneline -p origin/master