Skip to content

Commit 690c264

Browse files
committed
- Add support for modifying the complete command options
1 parent 188f0d6 commit 690c264

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

Runfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ summary "Runfile tasks for building the Completely gem"
66

77
import_gem 'runfile-tasks/gem'
88
import_gem 'runfile-tasks/docker', image: 'dannyben/completely', version: Completely::VERSION
9+
import 'debug'
910

1011
help 'Test the completely JSON schema'
1112
action :schema do

lib/completely/completions.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,5 +81,12 @@ def pattern_function_name
8181
def pattern_prefixes
8282
patterns.map(&:prefix)
8383
end
84+
85+
def complete_options_line
86+
options = config.options[:complete_options]
87+
return nil if options.nil? || options.strip.empty?
88+
89+
"#{options} "
90+
end
8491
end
8592
end

lib/completely/config.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module Completely
22
class Config
3-
attr_reader :config
3+
attr_reader :config, :options
44

55
class << self
66
def load(config_path)
@@ -17,6 +17,7 @@ def load(config_path)
1717
end
1818

1919
def initialize(config)
20+
@options = config.delete('completely_options')&.transform_keys(&:to_sym) || {}
2021
@config = config
2122
end
2223

lib/completely/templates/template.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@
4444
% end
4545
esac
4646
} &&
47-
complete -F <%= function_name %> <%= command %>
47+
complete <%= complete_options_line %>-F <%= function_name %> <%= command %>
4848

4949
# ex: filetype=sh

0 commit comments

Comments
 (0)