commit 3519ab515016d5d44b82fa25fabda84f2c2db5fe
parent d9a83d4f913cbf0549a0bfb7041d75d4112a666f
Author: Whyme Lyu <callme5long@gmail.com>
Date: Fri, 17 May 2013 00:17:04 +0800
Make axe() a little bit DRY.
This was part of a quick stab on leveraging HighLine's auto-completion
capability, which is not quite usable for now.
Diffstat:
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/bin/sup-config b/bin/sup-config
@@ -19,11 +19,12 @@ EOS
end
def axe q, default=nil
- ans = if default && !default.empty?
- ask "#{q} (enter for \"#{default}\"): "
- else
- ask "#{q}: "
- end
+ question = if default && !default.empty?
+ "#{q} (enter for \"#{default}\"): "
+ else
+ "#{q}: "
+ end
+ ans = ask question
ans.empty? ? default : ans.to_s
end