fylla 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fylla/completion_generator.rb +1 -1
- data/lib/fylla/erb_templates/zsh/command.erb +2 -13
- data/lib/fylla/parsed_option.rb +18 -5
- data/lib/fylla/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 314b5586ed38f48c0ddaec4a02725f2c8aac75e53c46be9bd9c49ce3f8732584
|
4
|
+
data.tar.gz: ad49c03801fdfef68904a27184ea0395b99a4c89ed14ebcf1a5d6392a73022d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4fa98a04457e512452f91bad2014b14887735f580e35d21398345371349c28b590f6f9f32dfb4e7338525f6b3b15402880c0005e8186d6c4978e4ac7eeaf113f
|
7
|
+
data.tar.gz: c2a727408a06d17d17d8f6a75e79efeb04e8923b7a8ff30064f26a560d3db8d518244cdb2a923814009227657b36f21337ac114a475bf3d87d5979e0e34f2184
|
@@ -176,7 +176,7 @@ module Fylla
|
|
176
176
|
def parse_options(options)
|
177
177
|
options.map do |opt|
|
178
178
|
description = opt.completion || opt.description || opt.banner || opt.name.to_s.upcase
|
179
|
-
ParsedOption.new(opt.name, description, opt.aliases, opt.enum, opt.filter)
|
179
|
+
ParsedOption.new(opt.name, description, opt.aliases, opt.enum, opt.filter, opt.type)
|
180
180
|
end
|
181
181
|
end
|
182
182
|
end
|
@@ -2,21 +2,10 @@ function _<%= @executable_name %><%= context_name %> {
|
|
2
2
|
_arguments \
|
3
3
|
<%- unless command.options.nil? -%>
|
4
4
|
<%- command.options.each do |option| -%>
|
5
|
-
<%- enums_exist = option.enum -%>
|
6
|
-
<%- filtered = option.filter -%>
|
7
5
|
<%- desc = option.description.gsub('"', %q|\\"|) -%>
|
8
|
-
|
9
|
-
<%- if filtered -%>
|
10
|
-
<%- actions = ": :_values -s , 'options' #{option.enum.join(' ')}" -%>
|
11
|
-
<%- else -%>
|
12
|
-
<%- actions = ": :_sequence -d compadd - #{option.enum.join(' ')}" -%>
|
13
|
-
<%- end -%>
|
14
|
-
"--<%= option.name %>=[<%= desc %>]<%= actions %>" \
|
15
|
-
<%- else -%>
|
16
|
-
"--<%= option.name %>[<%= desc %>]" \
|
17
|
-
<%- end -%>
|
6
|
+
"--<%= option.name %><%= option.equals_type %>[<%= desc %>]<%= option.action %>" \
|
18
7
|
<%- option.aliases.each do |al| -%>
|
19
|
-
"-<%= al %><%= option.
|
8
|
+
"-<%= al %><%= option.equals_type %>[<%= desc %>]<%= option.action %>" \
|
20
9
|
<%- end -%>
|
21
10
|
<%- end -%>
|
22
11
|
<%- end -%>
|
data/lib/fylla/parsed_option.rb
CHANGED
@@ -1,14 +1,27 @@
|
|
1
1
|
module Fylla
|
2
2
|
class ParsedOption
|
3
|
-
attr_accessor :aliases, :description, :name
|
4
|
-
attr_reader :completion, :banner # used just for parsing class_options recursively. Don't ever set these.
|
3
|
+
attr_accessor :aliases, :description, :name
|
4
|
+
attr_reader :completion, :banner, :enum, :filter, :type # used just for parsing class_options recursively. Don't ever set these.
|
5
|
+
attr_reader :action, :equals_type # used for erb file action
|
5
6
|
|
6
|
-
def initialize(name, description, aliases, enum, filter)
|
7
|
+
def initialize(name, description, aliases, enum, filter, type)
|
7
8
|
@name = name
|
8
9
|
@description = description
|
9
10
|
@aliases = aliases
|
10
|
-
@
|
11
|
-
@
|
11
|
+
@equals_type = type == :boolean ? '' : '=' # used for switches that take values (everything, but not necessary for boolean)
|
12
|
+
@action = ''
|
13
|
+
if enum
|
14
|
+
case type
|
15
|
+
when :array
|
16
|
+
if filter
|
17
|
+
@action = %Q|: :_values -s , 'options' #{enum.join(' ')}|
|
18
|
+
else
|
19
|
+
@action = %Q|: :_sequence -d compadd - #{enum.join(' ')}|
|
20
|
+
end
|
21
|
+
when :string
|
22
|
+
@action = %Q|: :(#{enum.join(' ')})|
|
23
|
+
end
|
24
|
+
end
|
12
25
|
end
|
13
26
|
end
|
14
27
|
end
|
data/lib/fylla/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fylla
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tyler Thrailkill
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-06-
|
11
|
+
date: 2019-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|