terraspace 0.5.6 → 0.5.7

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: 0e58f700f76a198ca29730aa7f8dfa70a009dd8fefc11e49c9796d060f01d6e1
4
- data.tar.gz: 81b4dfd9f3280335608feebcdace38ebc97f9dd2739272e10f7482feb95ed2f7
3
+ metadata.gz: 7497c859165e1d927b8ac4e7b50133b3eec5c807e2e9c8d3e088f7ff69327570
4
+ data.tar.gz: f3502a6e9983e8ffc93b8ffc9c380f2c2d46771c5719f7e5da5ce9060debb68d
5
5
  SHA512:
6
- metadata.gz: 71c1f99ec511b8f846d19978ba614e18801a267badc7df6d16b54113f7b9a9aafe959b3035af06e4efd46c6d2735af597532540edd849791b9b62f51f69087af
7
- data.tar.gz: afd0feb506627ce32f7bd986db7c4b41a995ddf744a1be9198a56a6928d2a1642b249925622c1de83eee65fd49307672a520aea4f446d0fadb9afb95c40c064d
6
+ metadata.gz: e5c718910a1da711fde1b5bb5282eb12f66af3c2336aa332fbf1f0320ffcb2b6daffe7c98ea02fb4b266030a314ad974d411bff34b90bac520240f7e4d495d26
7
+ data.tar.gz: cfdbd1ae125224dea80efb7bdfdf4b251e7767b49bb05ed38d735fda7c8eab29f86e88335b648873fbd5bcaf9c40ea37b9b845cc0b9ed6b4d0e3148d248f9b54
@@ -3,6 +3,9 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project *loosely tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
5
5
 
6
+ ## [0.5.7] - 2020-12-02
7
+ - [#64](https://github.com/boltops-tools/terraspace/pull/64) fix completion_script
8
+
6
9
  ## [0.5.6] - 2020-11-30
7
10
  - [#61](https://github.com/boltops-tools/terraspace/pull/61) allow envs and regions check feature
8
11
  - fix terraspace build before hook
@@ -1,74 +1,69 @@
1
- =begin
2
- Code Explanation:
3
-
4
- There are 3 types of things to auto-complete:
5
-
6
- 1. command: the command itself
7
- 2. parameters: command parameters.
8
- 3. options: command options
9
-
10
- Here's an example:
11
-
12
- mycli hello name --from me
13
-
14
- * command: hello
15
- * parameters: name
16
- * option: --from
17
-
18
- When command parameters are done processing, the remaining completion words will be options. We can tell that the command params are completed based on the method arity.
19
-
20
- ## Arity
21
-
22
- For example, say you had a method for a CLI command with the following form:
23
-
24
- ufo scale service count --cluster dev
25
-
26
- It's equivalent ruby method:
27
-
28
- scale(service, count) = has an arity of 2
29
-
30
- So typing:
31
-
32
- ufo scale service count [TAB] # there are 3 parameters including the "scale" command according to Thor's CLI processing.
33
-
34
- So the completion should only show options, something like this:
35
-
36
- --noop --verbose --cluster
37
-
38
- ## Splat Arguments
39
-
40
- When the ruby method has a splat argument, it's arity is negative. Here are some example methods and their arities.
41
-
42
- ship(service) = 1
43
- scale(service, count) = 2
44
- ships(*services) = -1
45
- foo(example, *rest) = -2
46
-
47
- Fortunately, negative and positive arity values are processed the same way. So we take simply take the absolute value of the arity and process it the same.
48
-
49
- Here are some test cases, hit TAB after typing the command:
50
-
51
- terraspace completion
52
- terraspace completion hello
53
- terraspace completion hello name
54
- terraspace completion hello name --
55
- terraspace completion hello name --noop
56
-
57
- terraspace completion
58
- terraspace completion sub:goodbye
59
- terraspace completion sub:goodbye name
60
-
61
- ## Subcommands and Thor::Group Registered Commands
62
-
63
- Sometimes the commands are not simple thor commands but are subcommands or Thor::Group commands. A good specific example is the ufo tool.
64
-
65
- * regular command: ufo ship
66
- * subcommand: ufo docker
67
- * Thor::Group command: ufo init
68
-
69
- Auto-completion accounts for each of these type of commands.
70
- =end
71
- module Terraspace
1
+ # begin
2
+ # Code Explanation:
3
+ #
4
+ # There are 3 types of things to auto-complete:
5
+ #
6
+ # 1. command: the command itself
7
+ # 2. parameters: command parameters.
8
+ # 3. options: command options
9
+ #
10
+ # Here's an example:
11
+ #
12
+ # mycli hello name --from me
13
+ #
14
+ # * command: hello
15
+ # * parameters: name
16
+ # * option: --from
17
+ #
18
+ # When command parameters are done processing, the remaining completion words will be options. We can tell that the command params are completed based on the method arity.
19
+ #
20
+ # ## Arity
21
+ #
22
+ # For example, say you had a method for a CLI command with the following form:
23
+ #
24
+ # terraspace up STACK
25
+ #
26
+ # It's equivalent ruby method:
27
+ #
28
+ # up(mod) = has an arity of 1
29
+ #
30
+ # So typing:
31
+ #
32
+ # terraspace up [TAB] # there is parameter including the "scale" command according to Thor's CLI processing.
33
+ #
34
+ # So the completion should only show options, something like this:
35
+ #
36
+ # --noop --verbose --cluster
37
+ #
38
+ # ## Splat Arguments
39
+ #
40
+ # When the ruby method has a splat argument, it's arity is negative. Here are some example methods and their arities.
41
+ #
42
+ # up(mod) = 1
43
+ # scale(service, count) = 2
44
+ # bundle(*args) = -1
45
+ # foo(example, *rest) = -2
46
+ #
47
+ # Fortunately, negative and positive arity values are processed the same way. So we take simply take the absolute value of the arity and process it the same.
48
+ #
49
+ # Here are some test cases, hit TAB after typing the command:
50
+ #
51
+ # terraspace completion
52
+ # terraspace completion up
53
+ # terraspace completion up name
54
+ # terraspace completion up name --
55
+ # terraspace completion up name --noop
56
+ #
57
+ # ## Subcommands and Thor::Group Registered Commands
58
+ #
59
+ # Sometimes the commands are not simple thor commands but are subcommands or Thor::Group commands. A good specific example is the terraspace tool.
60
+ #
61
+ # * regular command: terraspace up
62
+ # * subcommand: terraspace all
63
+ # * Thor::Group command: terraspace new project
64
+
65
+ # Auto-completion accounts for each of these type of commands.
66
+ class Terraspace::CLI
72
67
  class Completer
73
68
  def initialize(command_class, *params)
74
69
  @params = params
@@ -132,7 +127,6 @@ module Terraspace
132
127
 
133
128
  def params_completion
134
129
  offset = @params.size - 1
135
- offset_params = command_params[offset..-1]
136
130
  command_params[offset..-1].first
137
131
  end
138
132
 
@@ -1,6 +1,6 @@
1
- class Terraspace::Completer::Script
1
+ class Terraspace::CLI::Completer::Script
2
2
  def self.generate
3
3
  bash_script = File.expand_path("script.sh", File.dirname(__FILE__))
4
- logger.info "source #{bash_script}"
4
+ puts "source #{bash_script}"
5
5
  end
6
6
  end
@@ -1,3 +1,3 @@
1
1
  module Terraspace
2
- VERSION = "0.5.6"
2
+ VERSION = "0.5.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: terraspace
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.6
4
+ version: 0.5.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-11-30 00:00:00.000000000 Z
11
+ date: 2020-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -481,6 +481,9 @@ files:
481
481
  - lib/terraspace/cli/cloud.rb
482
482
  - lib/terraspace/cli/cloud/runs.rb
483
483
  - lib/terraspace/cli/commander.rb
484
+ - lib/terraspace/cli/completer.rb
485
+ - lib/terraspace/cli/completer/script.rb
486
+ - lib/terraspace/cli/completer/script.sh
484
487
  - lib/terraspace/cli/down.rb
485
488
  - lib/terraspace/cli/help.rb
486
489
  - lib/terraspace/cli/help/all/down.md
@@ -608,9 +611,6 @@ files:
608
611
  - lib/terraspace/compiler/strategy/tfvar/rb.rb
609
612
  - lib/terraspace/compiler/strategy/tfvar/tfvars.rb
610
613
  - lib/terraspace/compiler/writer.rb
611
- - lib/terraspace/completer.rb
612
- - lib/terraspace/completer/script.rb
613
- - lib/terraspace/completer/script.sh
614
614
  - lib/terraspace/core.rb
615
615
  - lib/terraspace/dependency/graph.rb
616
616
  - lib/terraspace/dependency/helper/base.rb