lib/hammer_cli/utils.rb in hammer_cli-3.10.0 vs lib/hammer_cli/utils.rb in hammer_cli-3.12.0
- old
+ new
@@ -53,11 +53,12 @@
def self.tty?
STDOUT.tty?
end
def self.clear_cache
- cache_file = File.expand_path(HammerCLI::Settings.get(:completion_cache_file))
- File.delete(cache_file) if File.exist?(cache_file)
+ if (completion_file = HammerCLI::Settings.get(:completion_cache_file))
+ FileUtils.rm_f(File.expand_path(completion_file))
+ end
end
def self.interactive?
return HammerCLI::Settings.get(:_params, :interactive) unless HammerCLI::Settings.get(:_params, :interactive).nil?
HammerCLI::Settings.get(:ui, :interactive) != false