mister_bin 0.7.4 → 0.7.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +20 -54
- data/lib/mister_bin/command.rb +4 -4
- data/lib/mister_bin/runner.rb +8 -4
- data/lib/mister_bin/version.rb +1 -1
- metadata +13 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0acb988ac9e4c15ffe3d81625b51b1e4a9bd6eefbeaa85ecb478b32e8be54c8
|
4
|
+
data.tar.gz: 8518da9a10b5ff5d9934d9045d4364ac5bfd0564be0f773a35830c985a444d40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a49296fd401d5adaf920fdbac936ee5c9d59e1bea4fa7b06fec226c19ae64f9ca29bdd3fe460a2ef4eadc28666edbb3dd7f4f90f5348678e7b6911c59bddca2
|
7
|
+
data.tar.gz: 5079f114df50a5bd184f82255b3a2bfff8ab82701d5fb343cd91a8b597c65811d72930cf44edbd9954114248491ff2b88f87d67b0ac038131261ed84dbd5135b
|
data/README.md
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
Mister Bin
|
2
|
-
==================================================
|
1
|
+
# Mister Bin
|
3
2
|
|
4
3
|
[](https://badge.fury.io/rb/mister_bin)
|
5
4
|
[](https://github.com/DannyBen/mister_bin/actions?query=workflow%3ATest)
|
@@ -12,34 +11,11 @@ interfaces for your gem or other Ruby application.
|
|
12
11
|
|
13
12
|
---
|
14
13
|
|
15
|
-
|
16
|
-
--------------------------------------------------
|
17
|
-
|
18
|
-
* [Installation](#installation)
|
19
|
-
* [Feature Highlights](#feature-highlights)
|
20
|
-
* [Examples](#examples)
|
21
|
-
* [Usage](#usage)
|
22
|
-
* [Creating the Main Executable](#creating-the-main-executable)
|
23
|
-
* [Runner Options](#runner-options)
|
24
|
-
* [Runner Routes](#runner-routes)
|
25
|
-
* [Creating Commands](#creating-commands)
|
26
|
-
* [Command DSL](#command-dsl)
|
27
|
-
* [Interactive Terminal](#interactive-terminal)
|
28
|
-
* [Terminal features](#terminal-features)
|
29
|
-
* [Terminal options](#terminal-options)
|
30
|
-
* [In the Wild](#in-the-wild)
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
Installation
|
35
|
-
--------------------------------------------------
|
14
|
+
## Installation
|
36
15
|
|
37
16
|
$ gem install mister_bin
|
38
17
|
|
39
|
-
|
40
|
-
|
41
|
-
Feature Highlights
|
42
|
-
--------------------------------------------------
|
18
|
+
## Feature Highlights
|
43
19
|
|
44
20
|
- Easy to use and minimalistic DSL for describing your command line actions.
|
45
21
|
- Each command is defined with a separate class for maximum testability and
|
@@ -47,20 +23,17 @@ Feature Highlights
|
|
47
23
|
- Commands can have subcommands.
|
48
24
|
- Designed for gem developers.
|
49
25
|
|
26
|
+
## Examples
|
50
27
|
|
28
|
+
This screencast shows the command line output of several Ruby gems that were
|
29
|
+
created with Mister Bin:
|
51
30
|
|
52
|
-
|
53
|
-
--------------------------------------------------
|
54
|
-
|
55
|
-

|
31
|
+

|
56
32
|
|
57
33
|
- See the [examples](/examples) folder for several example use cases.
|
58
34
|
- For real world examples, see the [In the Wild](#in-the-wild) section.
|
59
35
|
|
60
|
-
|
61
|
-
|
62
|
-
Usage
|
63
|
-
--------------------------------------------------
|
36
|
+
## Usage
|
64
37
|
|
65
38
|
Creating a command line utility with Mister Bin involves at least two files:
|
66
39
|
|
@@ -75,10 +48,7 @@ input, and if it finds one and one only, it will execute it. For example,
|
|
75
48
|
if you have a `server` command, you can execute it with `yourapp s` if it
|
76
49
|
is the only command that starts with an `s`.
|
77
50
|
|
78
|
-
|
79
|
-
|
80
|
-
Creating the Main Executable
|
81
|
-
--------------------------------------------------
|
51
|
+
## Creating the Main Executable
|
82
52
|
|
83
53
|
The main executable is usually simple and only serves to initialize Mister
|
84
54
|
Bin with options.
|
@@ -166,10 +136,7 @@ runner = MisterBin::Runner.new
|
|
166
136
|
runner.route_all to: GlobalCommand
|
167
137
|
```
|
168
138
|
|
169
|
-
|
170
|
-
|
171
|
-
Creating Commands
|
172
|
-
--------------------------------------------------
|
139
|
+
## Creating Commands
|
173
140
|
|
174
141
|
Create command classes by inheriting from `MisterBin::Command`, for example:
|
175
142
|
|
@@ -240,14 +207,12 @@ example "app ls"
|
|
240
207
|
example "app ls --all"
|
241
208
|
```
|
242
209
|
|
210
|
+
## Interactive Terminal
|
243
211
|
|
244
|
-
|
245
|
-
Interactive Terminal
|
246
|
-
--------------------------------------------------
|
247
212
|
Mister Bin comes with an interactive terminal that allows you to set up a
|
248
213
|
console that sends all commands to your runner.
|
249
214
|
|
250
|
-

|
251
216
|
|
252
217
|
See the [terminal example](/examples/06-terminal) folder.
|
253
218
|
|
@@ -340,8 +305,7 @@ If true, commands that start with `/` will *not* be delegated to the stsrem.
|
|
340
305
|
Default: `false`.
|
341
306
|
|
342
307
|
|
343
|
-
In the Wild
|
344
|
-
--------------------------------------------------
|
308
|
+
## In the Wild
|
345
309
|
|
346
310
|
Several examples of real world use of Mister Bin in the wild (well,
|
347
311
|
"In the Back Yard" really...).
|
@@ -351,16 +315,18 @@ Several examples of real world use of Mister Bin in the wild (well,
|
|
351
315
|
- [Jobly] - Compact job server with API, CLI and Web UI
|
352
316
|
- [Kojo] - Command line utility for generating config files from templates and definition files
|
353
317
|
- [Madman] - The Markdown Swiss Army Knife
|
318
|
+
- [Madness] - Instant Markdown Server
|
354
319
|
- [Slacktail] - Command line utility for following your Slack chat from the terminal
|
355
320
|
- [Site Link Analyzer] - Command line utility for finding broken links in a site
|
356
321
|
|
357
322
|
|
358
|
-
[docopt]: http://docopt.org/
|
359
|
-
[Kojo]: https://github.com/DannyBen/kojo
|
360
|
-
[Madman]: https://github.com/DannyBen/madman
|
361
323
|
[AudioAddict]: https://github.com/DannyBen/audio_addict
|
324
|
+
[Bashly]: https://github.com/DannyBen/bashly
|
362
325
|
[Colsole]: https://github.com/dannyben/colsole
|
326
|
+
[docopt]: http://docopt.org/
|
363
327
|
[Jobly]: https://github.com/dannyben/jobly
|
364
|
-
[
|
328
|
+
[Kojo]: https://github.com/DannyBen/kojo
|
329
|
+
[Madman]: https://github.com/DannyBen/madman
|
330
|
+
[Madness]: https://github.com/DannyBen/madness
|
365
331
|
[Site Link Analyzer]: https://github.com/dannyben/sla
|
366
|
-
[
|
332
|
+
[Slacktail]: https://github.com/dannyben/slacktail
|
data/lib/mister_bin/command.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'docopt_ng'
|
2
2
|
require 'colsole'
|
3
3
|
|
4
4
|
module MisterBin
|
@@ -12,13 +12,13 @@ module MisterBin
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def execute(argv = [])
|
15
|
-
@args =
|
15
|
+
@args = DocoptNG.docopt self.class.docopt, version: self.class.meta.version, argv: argv
|
16
16
|
target = self.class.find_target_command self, args
|
17
17
|
exitcode = send target
|
18
18
|
exitcode.is_a?(Numeric) ? exitcode : 0
|
19
|
-
rescue
|
19
|
+
rescue DocoptNG::Exit => e
|
20
20
|
puts e.message
|
21
|
-
|
21
|
+
e.exit_code
|
22
22
|
end
|
23
23
|
|
24
24
|
class << self
|
data/lib/mister_bin/runner.rb
CHANGED
@@ -30,8 +30,7 @@ module MisterBin
|
|
30
30
|
elsif (argv == ['--help']) || (argv == ['-h'])
|
31
31
|
show_help
|
32
32
|
elsif version && ((argv == ['--version']) || (argv == ['-v']))
|
33
|
-
|
34
|
-
1
|
33
|
+
show_version
|
35
34
|
else
|
36
35
|
execute argv
|
37
36
|
end
|
@@ -60,6 +59,11 @@ module MisterBin
|
|
60
59
|
argv
|
61
60
|
end
|
62
61
|
|
62
|
+
def show_version
|
63
|
+
puts version
|
64
|
+
0
|
65
|
+
end
|
66
|
+
|
63
67
|
def show_subs
|
64
68
|
if commands.empty?
|
65
69
|
say 'No subcommands found'
|
@@ -89,11 +93,11 @@ module MisterBin
|
|
89
93
|
def show_help
|
90
94
|
if commands.empty?
|
91
95
|
say 'No subcommands found'
|
96
|
+
1
|
92
97
|
else
|
93
98
|
show_help!
|
99
|
+
0
|
94
100
|
end
|
95
|
-
|
96
|
-
1
|
97
101
|
end
|
98
102
|
|
99
103
|
def show_help!
|
data/lib/mister_bin/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mister_bin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danny Ben Shitrit
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colsole
|
@@ -31,19 +31,25 @@ dependencies:
|
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '2'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
|
-
name:
|
34
|
+
name: docopt_ng
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '0.
|
39
|
+
version: '0.7'
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 0.7.1
|
40
43
|
type: :runtime
|
41
44
|
prerelease: false
|
42
45
|
version_requirements: !ruby/object:Gem::Requirement
|
43
46
|
requirements:
|
44
47
|
- - "~>"
|
45
48
|
- !ruby/object:Gem::Version
|
46
|
-
version: '0.
|
49
|
+
version: '0.7'
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 0.7.1
|
47
53
|
description: Easily add command line interface to your gems
|
48
54
|
email: db@dannyben.com
|
49
55
|
executables: []
|
@@ -70,14 +76,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
70
76
|
requirements:
|
71
77
|
- - ">="
|
72
78
|
- !ruby/object:Gem::Version
|
73
|
-
version: 2.
|
79
|
+
version: '2.7'
|
74
80
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
81
|
requirements:
|
76
82
|
- - ">="
|
77
83
|
- !ruby/object:Gem::Version
|
78
84
|
version: '0'
|
79
85
|
requirements: []
|
80
|
-
rubygems_version: 3.4.
|
86
|
+
rubygems_version: 3.4.7
|
81
87
|
signing_key:
|
82
88
|
specification_version: 4
|
83
89
|
summary: Command line interface for your gems
|