completely 0.6.0 → 0.6.2

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: b40f2059243b2820d2ce140394be5551e5ddb131351adb35d26343841f8a54c7
4
- data.tar.gz: 71e01f5c44395f97023afff5a1822c5fa651efb98155a3b8dd05f750a19a5419
3
+ metadata.gz: c273101b2b80aad90b161621c5af8296f29e02520c3e7db620f905c97b466bdd
4
+ data.tar.gz: 67b0e2b8b3434c25ae63a6b37fbb3603ffa7bcf1a1aca1e3d7f89beab61655aa
5
5
  SHA512:
6
- metadata.gz: 71d90d706eb26933817483395670eb5d5ed516b606b62c1f4b9408afdec92b977142e4b2501ff12b75bb47fa971e558696ef5294a3c569f3856da8cb9904254f
7
- data.tar.gz: df1e950e2f839a977181521bb09fb917e6d47046f4f6b80d7a8dfc557b2c5d67ee66f962b7a23fd2456137a283bae6ffc9fe38e9ad97355c53c82a1ec84cff7a
6
+ metadata.gz: 06e7729112f9b6d3a62e8ab58a5f38999b2e799844a07e1a43b4c12c4d6497d8c0ce3ebbdda1de7808639567783e44263c63b7e5fe2d4d36abf2a9d4030851ee
7
+ data.tar.gz: 350d9dd114c588e6221a79044ce96a497c5d5d342123fe09031b97a7eb5afbdcfde8f34078ecad001db83e5af56e0f1777eb997895c85a0f6f87620dd93315d4
data/README.md CHANGED
@@ -227,6 +227,7 @@ Alternatively, you can copy the script manually to one of these directories
227
227
 
228
228
  - `/usr/share/bash-completion/completions`
229
229
  - `/usr/local/etc/bash_completion.d`
230
+ - `~/.local/share/bash-completion/completions`
230
231
 
231
232
  ## Testing and debugging completion scripts
232
233
 
@@ -1,10 +1,11 @@
1
1
  require 'mister_bin'
2
- require 'completely/version'
3
2
  require 'completely/commands/generate'
4
3
  require 'completely/commands/init'
5
4
  require 'completely/commands/install'
6
5
  require 'completely/commands/preview'
7
6
  require 'completely/commands/test'
7
+ require 'completely/commands/uninstall'
8
+ require 'completely/version'
8
9
 
9
10
  module Completely
10
11
  class CLI
@@ -18,6 +19,7 @@ module Completely
18
19
  runner.route 'generate', to: Commands::Generate
19
20
  runner.route 'test', to: Commands::Test
20
21
  runner.route 'install', to: Commands::Install
22
+ runner.route 'uninstall', to: Commands::Uninstall
21
23
 
22
24
  runner
23
25
  end
@@ -21,12 +21,12 @@ module Completely
21
21
 
22
22
  def run
23
23
  if args['--dry']
24
- puts installer.command_string
24
+ puts installer.install_command_string
25
25
  return
26
26
  end
27
27
 
28
28
  success = installer.install force: args['--force']
29
- raise InstallError, "Failed running command:\nnb`#{installer.command_string}`" unless success
29
+ raise InstallError, "Failed running command:\nnb`#{installer.install_command_string}`" unless success
30
30
 
31
31
  say "Saved m`#{installer.target_path}`"
32
32
  say 'You may need to restart your session to test it'
@@ -0,0 +1,39 @@
1
+ require 'completely/commands/base'
2
+
3
+ module Completely
4
+ module Commands
5
+ class Uninstall < Base
6
+ summary 'Uninstall a bash completion script'
7
+
8
+ help <<~HELP
9
+ This command will remove the completion script for the specified program from all the bash completion directories.
10
+ HELP
11
+
12
+ usage 'completely uninstall PROGRAM [--dry]'
13
+ usage 'completely uninstall (-h|--help)'
14
+
15
+ option '-d --dry', 'Show the uninstallation command but do not run it'
16
+
17
+ param 'PROGRAM', 'Name of the program the completions are for.'
18
+
19
+ def run
20
+ if args['--dry']
21
+ puts installer.uninstall_command_string
22
+ return
23
+ end
24
+
25
+ success = installer.uninstall
26
+ raise InstallError, "Failed running command:\nnb`#{installer.uninstall_command_string}`" unless success
27
+
28
+ say 'Done'
29
+ say 'You may need to restart your session to test it'
30
+ end
31
+
32
+ private
33
+
34
+ def installer
35
+ Installer.new program: args['PROGRAM']
36
+ end
37
+ end
38
+ end
39
+ end
@@ -11,17 +11,27 @@ module Completely
11
11
  @target_directories ||= %W[
12
12
  /usr/share/bash-completion/completions
13
13
  /usr/local/etc/bash_completion.d
14
+ #{Dir.home}/.local/share/bash-completion/completions
14
15
  #{Dir.home}/.bash_completion.d
15
16
  ]
16
17
  end
17
18
 
18
- def command
19
+ def install_command
19
20
  result = root_user? ? [] : %w[sudo]
20
21
  result + %W[cp #{script_path} #{target_path}]
21
22
  end
22
23
 
23
- def command_string
24
- command.join ' '
24
+ def install_command_string
25
+ install_command.join ' '
26
+ end
27
+
28
+ def uninstall_command
29
+ result = root_user? ? [] : %w[sudo]
30
+ result + %w[rm -f] + target_directories.map { |dir| "#{dir}/#{program}" }
31
+ end
32
+
33
+ def uninstall_command_string
34
+ uninstall_command.join ' '
25
35
  end
26
36
 
27
37
  def target_path
@@ -41,7 +51,11 @@ module Completely
41
51
  raise InstallError, "File exists: m`#{target_path}`"
42
52
  end
43
53
 
44
- system(*command)
54
+ system(*install_command)
55
+ end
56
+
57
+ def uninstall
58
+ system(*uninstall_command)
45
59
  end
46
60
 
47
61
  private
@@ -1,3 +1,3 @@
1
1
  module Completely
2
- VERSION = '0.6.0'
2
+ VERSION = '0.6.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: completely
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danny Ben Shitrit
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-23 00:00:00.000000000 Z
11
+ date: 2023-12-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colsole
@@ -61,6 +61,7 @@ files:
61
61
  - lib/completely/commands/install.rb
62
62
  - lib/completely/commands/preview.rb
63
63
  - lib/completely/commands/test.rb
64
+ - lib/completely/commands/uninstall.rb
64
65
  - lib/completely/completions.rb
65
66
  - lib/completely/exceptions.rb
66
67
  - lib/completely/installer.rb
@@ -78,7 +79,7 @@ metadata:
78
79
  changelog_uri: https://github.com/DannyBen/completely/blob/master/CHANGELOG.md
79
80
  source_code_uri: https://github.com/DannyBen/completely
80
81
  rubygems_mfa_required: 'true'
81
- post_install_message:
82
+ post_install_message:
82
83
  rdoc_options: []
83
84
  require_paths:
84
85
  - lib
@@ -93,8 +94,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
94
  - !ruby/object:Gem::Version
94
95
  version: '0'
95
96
  requirements: []
96
- rubygems_version: 3.4.14
97
- signing_key:
97
+ rubygems_version: 3.3.26
98
+ signing_key:
98
99
  specification_version: 4
99
100
  summary: Bash Completions Generator
100
101
  test_files: []