samovar 2.5.0 → 2.5.1
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
- checksums.yaml.gz.sig +0 -0
- data/lib/samovar/completion/context.rb +7 -11
- data/lib/samovar/split.rb +1 -1
- data/lib/samovar/version.rb +1 -1
- data/readme.md +4 -0
- data/releases.md +4 -0
- data.tar.gz.sig +0 -0
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b8bdded07aeaa6cc737bf9c08155dcd2c954521f8cd066dbeb6786c5ba325b02
|
|
4
|
+
data.tar.gz: a469ff20b8426b570700cb6cc2daaba39e689aa12f8df58ed9701a516f2be4f0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e48219e31bda0451b3c59752077f470e55794621f2f1b011d60b73caae7bf0695ba7c4a90c7f956e02ff066e5ca12102e571fcc543632da64d1edaa1a69b1a44
|
|
7
|
+
data.tar.gz: 230b563dd99c38945c8ea041ed399eaea8f245bf6476295ec097cebdd818c5f1cd66473603a37f51c741a0bdb3a991f94595e145a0714ed7f3715e92b5c131b2
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
|
@@ -16,10 +16,13 @@ module Samovar
|
|
|
16
16
|
# @parameter environment [Hash] The environment for completion callbacks.
|
|
17
17
|
# @returns [Context] The completion context.
|
|
18
18
|
def self.for(command_class, arguments, environment: ENV)
|
|
19
|
+
arguments = arguments.dup
|
|
20
|
+
current = arguments.pop || ""
|
|
21
|
+
|
|
19
22
|
return self.new(
|
|
20
23
|
command_class.table.merged,
|
|
21
24
|
arguments,
|
|
22
|
-
|
|
25
|
+
current,
|
|
23
26
|
environment: environment,
|
|
24
27
|
)
|
|
25
28
|
end
|
|
@@ -27,7 +30,7 @@ module Samovar
|
|
|
27
30
|
# Initialize a new completion context.
|
|
28
31
|
#
|
|
29
32
|
# @parameter table [Table] The command table to complete.
|
|
30
|
-
# @parameter arguments [Array(String)] The
|
|
33
|
+
# @parameter arguments [Array(String)] The completed words before the current token.
|
|
31
34
|
# @parameter current [String] The token being completed.
|
|
32
35
|
# @parameter row [Object | Nil] The parser row whose value is being completed.
|
|
33
36
|
# @parameter environment [Hash] The environment for completion callbacks.
|
|
@@ -42,7 +45,7 @@ module Samovar
|
|
|
42
45
|
# @attribute [Table] The command table to complete.
|
|
43
46
|
attr :table
|
|
44
47
|
|
|
45
|
-
# @attribute [Array(String)] The
|
|
48
|
+
# @attribute [Array(String)] The completed words before the current token.
|
|
46
49
|
attr :arguments
|
|
47
50
|
|
|
48
51
|
# @attribute [String] The token being completed.
|
|
@@ -68,18 +71,11 @@ module Samovar
|
|
|
68
71
|
)
|
|
69
72
|
end
|
|
70
73
|
|
|
71
|
-
# The completed words before the current token.
|
|
72
|
-
#
|
|
73
|
-
# @returns [Array(String)] The arguments before the token being completed.
|
|
74
|
-
def words
|
|
75
|
-
@arguments.take(@arguments.size - 1)
|
|
76
|
-
end
|
|
77
|
-
|
|
78
74
|
# Complete the current command class.
|
|
79
75
|
#
|
|
80
76
|
# @returns [Result] The completion result.
|
|
81
77
|
def complete
|
|
82
|
-
complete_rows(@table,
|
|
78
|
+
complete_rows(@table, @arguments.dup)
|
|
83
79
|
end
|
|
84
80
|
|
|
85
81
|
# Complete the given command class with completed words.
|
data/lib/samovar/split.rb
CHANGED
data/lib/samovar/version.rb
CHANGED
data/readme.md
CHANGED
|
@@ -24,6 +24,10 @@ Please see the [project documentation](https://ioquatix.github.io/samovar/) for
|
|
|
24
24
|
|
|
25
25
|
Please see the [project releases](https://ioquatix.github.io/samovar/releases/index) for all releases.
|
|
26
26
|
|
|
27
|
+
### v2.5.1
|
|
28
|
+
|
|
29
|
+
- Fix completion of empty arguments.
|
|
30
|
+
|
|
27
31
|
### v2.5.0
|
|
28
32
|
|
|
29
33
|
- Introduce `Command#complete` which provides a hook for command completion logic, allowing developers to implement custom tab-completion behavior for their commands.
|
data/releases.md
CHANGED
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
|
Binary file
|