bashly 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7fe733a46c8634cc39b4c792b177ca9ac7610a8d408714fa482b3c0ad15fc10f
4
- data.tar.gz: 908960de1cb2d682ff801630e0f6667a42df171612ed6a92aee72bcc369cc0e2
3
+ metadata.gz: 3a6c888335f32b6223149d91ed739e189ffbc6921afec05ff709380c76387338
4
+ data.tar.gz: b964b4ac7a5fa86f8766b350a3240ee00882be5cfc574e97f001a832a506e342
5
5
  SHA512:
6
- metadata.gz: 9e0dcf39faf63d5d798fac7ed41768994ec6715a58b898e390ec2a6019948497d314c08bc8ce1041fb5f1a105884a04d759e258085fdcf7fbbe87af1c4a7a4e0
7
- data.tar.gz: 83279b0a7df6eb6f3c2a779bbc54221e9cad58e6e08c4a207f1d592aa12329cc488d7169b682191be02474f098dbfda0f3d6ad6cd03e3a91e1bf793bb29fcdc3
6
+ metadata.gz: e1e2757a735e55ffc4d4b27633d6df020184521ed8eb6377c0f26f8edd7442d28fb2a3c56c056de4558aab2204f7d522e15df6374f1962fcbaf26226f590d22b
7
+ data.tar.gz: a8aa77fba152f005136ff8ee8aacdc7236f15975042c4066f6d94e7e400133e2ca4137ffbbe9bc6f458c2aae2784aa956721d9179862cd78bf95ec6f99f39bd3
data/README.md CHANGED
@@ -349,50 +349,29 @@ functionality to your script in one of three ways:
349
349
 
350
350
  The bash completions generation is completely automatic, and you will have to
351
351
  rerun the `bashly add comp *` command whenever you change your `bashly.yml`
352
- script.
352
+ file.
353
353
 
354
354
  In addition to suggesting subcommands and flags, you can instruct bashly to
355
- also suggest files, directories, users and more. To do this, add another option
356
- in your `bashly.yml` on the command you wish to alter:
355
+ also suggest files, directories, users, git branches and more. To do this,
356
+ add another option in your `bashly.yml` on the command you wish to alter:
357
357
 
358
358
  ```yaml
359
359
  # bashly.yml
360
360
  commands:
361
361
  - name: upload
362
362
  help: Upload a file
363
- completions: [directory, user]
363
+ completions:
364
+ - <directory>
365
+ - <user>
366
+ - $(git branch 2> /dev/null)
364
367
 
365
368
  ```
366
369
 
367
- Valid completion additions are:
368
-
369
- | Keyword | Meaning
370
- |-------------|---------------------
371
- | `alias` | Alias names
372
- | `arrayvar` | Array variable names
373
- | `binding` | Readline key binding names
374
- | `builtin` | Names of shell builtin commands
375
- | `command` | Command names
376
- | `directory` | Directory names
377
- | `disabled` | Names of disabled shell builtins
378
- | `enabled` | Names of enabled shell builtins
379
- | `export` | Names of exported shell variables
380
- | `file` | File names
381
- | `function` | Names of shell functions
382
- | `group` | Group names
383
- | `helptopic` | Help topics as accepted by the help builtin
384
- | `hostname` | Hostnames, as taken from the file specified by the HOSTFILE shell variable
385
- | `job` | Job names
386
- | `keyword` | Shell reserved words
387
- | `running` | Names of running jobs
388
- | `service` | Service names
389
- | `signal` | Signal names
390
- | `stopped` | Names of stopped jobs
391
- | `user` | User names
392
- | `variable` | Names of all shell variables
393
-
394
- Note that these are taken from the [Programmable Completion Builtin][compgen],
395
- and will simply be added using the `compgen -A action` command.
370
+ - Anything between `<...>` will be added using the `compgen -A action` flag.
371
+ - Anything else, will be appended to the `compgen -W` flag.
372
+
373
+ For more information about these custom completions, see the documentation for
374
+ the [completely][completely] gem.
396
375
 
397
376
 
398
377
  ## Real World Examples
@@ -31,18 +31,15 @@ module Bashly
31
31
  flags.map(&:name) + flags.map(&:short)
32
32
  end
33
33
 
34
- def completion_actions
35
- completions ? completions.map { |c| "<#{c}>" } : []
36
- end
37
-
38
34
  def completion_words(with_version: false)
39
35
  trivial_flags = %w[--help -h]
40
36
  trivial_flags += %w[--version -v] if with_version
41
37
  all = (
42
38
  command_names + trivial_flags +
43
- completion_flag_names + completion_actions
39
+ completion_flag_names
44
40
  )
45
41
 
42
+ all += completions if completions
46
43
  all.compact.uniq.sort
47
44
  end
48
45
 
@@ -1,3 +1,3 @@
1
1
  module Bashly
2
- VERSION = "0.6.0"
2
+ VERSION = "0.6.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bashly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danny Ben Shitrit