cetus 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/bin/cetus +23 -11
  2. data/cetus.gemspec +1 -1
  3. metadata +3 -3
data/bin/cetus CHANGED
@@ -6,7 +6,7 @@
6
6
  # Author: rkumar http://github.com/rkumar/cetus/
7
7
  # Date: 2013-02-17 - 17:48
8
8
  # License: GPL
9
- # Last update: 2013-03-06 12:32
9
+ # Last update: 2013-03-06 20:06
10
10
  # ----------------------------------------------------------------------------- #
11
11
  # cetus.rb Copyright (C) 2012-2013 rahul kumar
12
12
  require 'readline'
@@ -552,7 +552,7 @@ def run_command f
552
552
  puts "#{command} #{files} #{command2}"
553
553
  system "#{command} #{files} #{command2}"
554
554
  rescue Exception => ex
555
- perror "Canceled command, press a key"
555
+ perror "Canceled command, (#{ex}) press a key"
556
556
  return
557
557
  end
558
558
  begin
@@ -986,7 +986,8 @@ def config_read
986
986
  $used_dirs.push(*(DIRS.split ":"))
987
987
  $visited_files.push(*(FILES.split ":"))
988
988
  #$bookmarks.push(*bookmarks) if bookmarks
989
- chars = ('A'..'Z')
989
+ chars = ('A'..'Z').to_a
990
+ chars.concat( ('0'..'9').to_a )
990
991
  chars.each do |ch|
991
992
  if Kernel.const_defined? "BM_#{ch}"
992
993
  $bookmarks[ch] = Kernel.const_get "BM_#{ch}"
@@ -1208,6 +1209,7 @@ end
1208
1209
  # I should be able to pass in new actions that are external commands
1209
1210
  def file_actions action=nil
1210
1211
  h = { :d => :delete, :m => :move, :r => :rename, :v => ENV["EDITOR"] || :vim,
1212
+ :c => :copy, :C => :chdir,
1211
1213
  :l => :less, :s => :most , :f => :file , :o => :open, :x => :dtrx, :z => :zip }
1212
1214
  #acttext = h[action.to_sym] || action
1213
1215
  acttext = action || ""
@@ -1253,16 +1255,25 @@ def file_actions action=nil
1253
1255
  #target = gets().chomp
1254
1256
  target = Readline::readline('>', true)
1255
1257
  return if target == ""
1256
- if target.size > 2
1257
- if File.directory? target
1258
- FileUtils.mv text, target
1259
- refresh
1260
- else
1261
- perror "Target not a dir"
1262
- end
1258
+ if File.directory? target
1259
+ FileUtils.mv text, target
1260
+ refresh
1261
+ else
1262
+ perror "Target not a dir"
1263
+ end
1264
+ when :copy
1265
+ print "copy #{text} to : "
1266
+ target = Readline::readline('>', true)
1267
+ return if target == ""
1268
+ target = File.basename(text) if target == "."
1269
+ if File.exists? target
1270
+ perror "Target (#{target}) exists"
1263
1271
  else
1264
- perror "Cancelled move"
1272
+ FileUtils.cp text, target
1273
+ refresh
1265
1274
  end
1275
+ when :chdir
1276
+ change_dir File.dirname(text)
1266
1277
  when :zip
1267
1278
  print "Archive name: "
1268
1279
  #target = gets().chomp
@@ -1355,6 +1366,7 @@ def locate
1355
1366
  return if pattern == ""
1356
1367
  $title = "Files found using 'locate' #{pattern}"
1357
1368
  files = `locate #{pattern}`.split("\n")
1369
+ files.reject! {|x| x = File.expand_path(x); !File.exists?(x) }
1358
1370
  if files.size == 0
1359
1371
  perror "No files found."
1360
1372
  else
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "cetus"
8
- spec.version = "0.1.5"
8
+ spec.version = "0.1.6"
9
9
  spec.authors = ["Rahul Kumar"]
10
10
  spec.email = ["sentinel1879@gmail.com"]
11
11
  spec.description = %q{lightning fast file navigator}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cetus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -73,7 +73,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
73
73
  version: '0'
74
74
  segments:
75
75
  - 0
76
- hash: 1144309050134639096
76
+ hash: -211898789644327030
77
77
  required_rubygems_version: !ruby/object:Gem::Requirement
78
78
  none: false
79
79
  requirements:
@@ -82,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
82
  version: '0'
83
83
  segments:
84
84
  - 0
85
- hash: 1144309050134639096
85
+ hash: -211898789644327030
86
86
  requirements: []
87
87
  rubyforge_project:
88
88
  rubygems_version: 1.8.25