2
2
3
3
[ docopt] ( http://docopt.org/ ) for shell - make beautiful CLI with ease.
4
4
5
- Status: Alpha - work is done .
5
+ Status: working .
6
6
7
7
` docopts ` : the command line wrapper for bash.
8
8
@@ -14,10 +14,10 @@ GNU/Linux OS.
14
14
[ make README.md ] : # ( ./docopts --version | get_version "This is a transitional release:" )
15
15
16
16
```
17
- This is a transitional release: docopts 0 .6.3
17
+ This is a transitional release: v0 .6.3-rc1
18
18
```
19
19
20
- This release will be maintained for compatibility, only fixes will be provided. The 0.6.2 version is fully compatible with
20
+ This release will be maintained for compatibility, only fixes will be provided. The 0.6.3 version is fully compatible with
21
21
the previous version of ` docopts ` .
22
22
23
23
## SYNOPSIS
@@ -286,24 +286,37 @@ cp docopts docopts.sh /usr/local/bin
286
286
287
287
### Pre-built binaries
288
288
289
- Pre-built Go binaries for GNU/Linux (32 and 64 bits) are attached to [ releases] ( https://github.com/Sylvain303 /docopts/releases ) .
289
+ Pre-built Go binaries for GNU/Linux (32 and 64 bits) are attached to [ releases] ( https://github.com/docopt /docopts/releases ) .
290
290
291
- Download and rename to ` docopts ` and put it in your ` PATH ` :
291
+ We provide a download helper :
292
292
293
+ ``` bash
294
+ git clone https://github.com/docopt/docopts.git
295
+ cd doctops
296
+ ./get_docopts.sh
293
297
```
294
- mv docopts-32bit docopts
298
+
299
+ Rename to ` docopts ` and put it in your ` PATH ` :
300
+
301
+ ``` bash
302
+ mv docopts_linux_amd64 docopts
295
303
cp docopts docopts.sh /usr/local/bin
296
304
```
297
305
298
- You are strongly encouraged to build your own binary, which is easy once
299
- you have Go installed. Or find a local golang developer that you
300
- trust and ask her, in exchange for a beer or two, if she could build it for you. ;)
306
+ The cloned repository is no more used at this stage.
307
+
308
+ Learn more about [ pre-built binaries ] ( docs/pre_built_binaries.md ) .
301
309
302
310
## Compiling
303
311
304
- Requires a directory to use as a [ Go workspace] ( https://golang.org/doc/code.html#Organization ) .
312
+ We encourage you to build your own binary, which is easy once
313
+ you have Go installed. Or find a local golang developer that you
314
+ trust and ask her, in exchange for a beer or two, if she could build it for you. ;)
315
+
316
+ Requires a [ Go workspace] ( https://golang.org/doc/code.html#Organization ) .
305
317
306
318
local build:
319
+ (also done with our Makefile default target: ` make ` )
307
320
308
321
```
309
322
go get github.com/docopt/docopt-go
@@ -318,119 +331,39 @@ cross compile for 32 bit:
318
331
env GOOS=linux GOARCH=386 go build docopts.go
319
332
```
320
333
321
- or via Makefile (generates 64 bit, 32 bit, arm and macOS-64bit versions of docopts)
334
+ or via Makefile:
322
335
323
336
```
324
337
cd src/github.com/docopt/docopts
325
338
make all
326
339
make test
327
340
```
328
341
329
- Tested builds are built on: ` go version go1.11.4 linux/amd64 `
342
+ Tested builds are built on:
343
+
344
+ [ make README.md ] : # ( go version )
345
+
346
+ ```
347
+ go version go1.11.4 linux/amd64
348
+ ```
330
349
331
350
## Features
332
351
333
352
Warning: may be not up-to-date feature list.
334
353
335
354
The [ ` docopts.sh ` ] ( docopts.sh ) helper is an extra bash library that you can source in your shell script.
336
- This library provides some bash helpers and is not required in order to use ` docopts ` .
355
+ This library provides some bash helpers and is not required in order to use ` docopts ` . See [ docopts.sh
356
+ documentation] ( docs/README.md ) .
337
357
338
- You don 't need a python interpreter anymore, so it works on any legacy system.
358
+ ` docopts ` doesn 't need a python interpreter anymore, so it works on any legacy system too .
339
359
340
360
As of 2019-05-18
341
361
342
362
* ` docopts ` is able to reproduce 100% of the python version.
343
- * unit tests for go are provided, so hack as you wish.
344
- * 100% of ` language_agnostic_tester.py ` tests pass (GNU/Linux 64bits)
363
+ * unit tests for Go are provided, so hack as you wish.
364
+ * 100% of ` language_agnostic_tester.py ` tests pass (GNU/Linux 64bits).
365
+ * ` bats-core ` unittests and fonctional testing are provided too.
345
366
346
367
## Developers
347
368
348
- All python related stuff has been removed, excepted ` language_agnostic_tester.py ` .
349
-
350
- If you want to clone this repository and hack ` docopts ` :
351
-
352
- Use ` git clone --recursive ` , to get submodules - these are only required for testing with ` bats ` .
353
- If [ ` bats-core ` ] ( https://github.com/bats-core/bats-core ) installed in your PATH should work too.
354
-
355
- Fetch the extra golang version of ` docopt-go ` (required for building ` docopts ` )
356
-
357
- ```
358
- go get github.com/docopt/docopt-go
359
- ```
360
-
361
- If you forgot ` --recursive ` , you can also run it afterwards:
362
-
363
- ~~~ bash
364
- git submodule init
365
- git submodule update
366
- ~~~
367
-
368
- Current folder structure:
369
-
370
- ~~~
371
- .
372
- ├── docopts.go - main source code
373
- ├── docopts_test.go - go unit tests
374
- ├── docopts.sh - library wrapper and helpers
375
- ├── examples - many ported examples in bash, all must be working
376
- ├── language_agnostic_tester.py - old python JSON tester still used with testee.sh
377
- ├── LICENSE-MIT
378
- ├── PROGRESS.md - what I'm working on
379
- ├── README.md
380
- ├── testcases.docopt - agnostic testcases copied from python's docopt
381
- ├── testee.sh - bash wrapper to convert docopts output to JSON (now uses docopts.sh)
382
- ├── tests - unit and functional testing written in bats (requires submodule)
383
- └── TODO.md - Some todo list on this golang version of docopts
384
- ~~~
385
-
386
- ## Tests
387
-
388
- Some tests are coded along with this code base:
389
-
390
- - bats - bash unit tests and functional testing.
391
- - ` language_agnostic_tester.py ` - old python wrapper, full docopt compatibility tests.
392
- - See also: [ docopt.go] ( https://github.com/docopt/docopt.go ) has its own tests in golang.
393
- - ` docopts_test.go ` - go unit test for ` docopts.go `
394
-
395
- ### Running tests
396
-
397
- ```
398
- make test
399
- ```
400
-
401
- #### bats
402
-
403
- ` bats.alias ` modify your current environment to define a alias on the submodule of ` bats ` installed (if you did it).
404
-
405
- ```
406
- cd ./tests
407
- . bats.alias
408
- bats .
409
- ```
410
-
411
- #### ` language_agnostic_tester `
412
-
413
- This script was provided with the original ` docopts ` . I fixed number/string output parsing failure with an extra function
414
- for bash in [ docopts.sh] ( https://github.com/docopt/docopts/blob/docopts-go/docopts.sh#L108 )
415
- ` docopt_get_raw_value() ` . This is a hack to get 100% pass, and it is not very efficient.
416
-
417
- Run these tests from top of repo:
418
- ```
419
- python language_agnostic_tester.py ./testee.sh
420
- ```
421
-
422
- #### golang docopt.go (golang parser lib)
423
-
424
- This lib is outside this project, but it is the base of the ` docopt ` language parsing for this wrapper.
425
-
426
- ```
427
- cd PATH/to/go/src/github.com/docopt/docopt-go/
428
- go test -v .
429
- ```
430
-
431
- #### golang docopts (our bash wrapper)
432
-
433
- ```
434
- cd PATH/to/go/src/github.com/docopt/docopts
435
- go test -v
436
- ```
369
+ Read the [ doc for developer] ( docs/developer.md ) .
0 commit comments