cetus 0.1.33 → 0.1.34

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/cetus +33 -47
  3. data/cetus.gemspec +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6ff3303709b421f3fed64413d85fc6c78e7693e3fd57f4223da67a6044a302eb
4
- data.tar.gz: 414a490eb02e8aa98701b86674cf67597fca22cc144a2aedb1c5bbd0c7c37789
3
+ metadata.gz: 443d16e21b148f67cc9f5e946cd30c208849851d3f00d61654f9397608d9efc2
4
+ data.tar.gz: e313ebd0039f87472eff95115a56484bb2fa298e2a94783ea52bdeb804fcaeed
5
5
  SHA512:
6
- metadata.gz: ab77cb6b97de0d32f4ec89540ea0c296164d54805f9d4a83c452d9b513712e2a6a2942a4a16071e3f5fb3c2add77077e179d7c1028cd36f8a0003d357b797377
7
- data.tar.gz: def9fe901b105277bedcfd6e6c6cd9fd1a41bb25771bbd6306f1c457f8f6b380a51d248081d456f864be37618f32398c41e69e1e8e1267e968473a66b2810302
6
+ metadata.gz: fc89827c004339856387fa481fd88ae15bf5a0d0eb0ae75fc4a7837ea055adc9f19e96b6ac128897c2655beeaedc0bdbbc72b023155b0dbd1ee9322f0ae818c1
7
+ data.tar.gz: b72d9d557dba6c150720362053ba247df1745c018a53c387ef857f63d2b6937931f59668b2fa2b518456a6972353f228cc975e8c760ebecf00f4a07faf1ecd8e
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: 2019-04-10 10:16
9
+ # Last update: 2019-04-10 11:18
10
10
  # --------------------------------------------------------------------------- #
11
11
  # cetus.rb Copyright (C) 2012-2019 rahul kumar
12
12
  # == CHANGELOG
@@ -39,7 +39,7 @@ require 'logger'
39
39
  # alias c=~/bin/cetus.rb
40
40
  # c
41
41
 
42
- VERSION = '0.1.33.0'.freeze
42
+ VERSION = '0.1.34.0'.freeze
43
43
  CONFIG_PATH = ENV['XDG_CONFIG_HOME'] || File.join(ENV['HOME'], '.config')
44
44
  CONFIG_FILE = "#{CONFIG_PATH}/cetus/conf.yml".freeze
45
45
 
@@ -67,6 +67,7 @@ $bindings = {
67
67
  '.' => 'pop_dir',
68
68
  ':' => 'subcommand',
69
69
  "'" => 'goto_bookmark',
70
+ '"' => 'file_starting_with',
70
71
  '/' => 'enter_regex',
71
72
  'M-p' => 'prev_page',
72
73
  'M-n' => 'next_page',
@@ -704,14 +705,14 @@ end
704
705
  # numbers represent quick bookmarks
705
706
  # if bookmark exists, go to else create it.
706
707
  def resolve_numeric_key key
707
- d = $bookmarks[key]
708
- if d
709
- change_dir d
710
- return
711
- end
708
+ d = $bookmarks[key]
709
+ if d
710
+ change_dir d
711
+ return
712
+ end
712
713
 
713
- set_bookmark key
714
- message "Created bookmark #{key}."
714
+ set_bookmark key
715
+ message "Created bookmark #{key}."
715
716
  end
716
717
 
717
718
  def set_bookmark key, dir=Dir.pwd
@@ -1342,38 +1343,20 @@ def goto_home_dir
1342
1343
  change_dir '~'
1343
1344
  end
1344
1345
 
1345
- ## This actually filters, in zfm it goes to that entry since we have a cursor there
1346
- #
1347
- def goto_entry_starting_with(fc = nil)
1348
- unless fc
1349
- print 'Entries starting with: '
1350
- fc = get_char
1351
- end
1352
- return if fc.size != 1
1353
-
1354
- ## this is wrong and duplicates the functionality of /
1355
- # It shoud go to cursor of item starting with fc
1356
- $patt = "^#{fc}"
1357
- end
1358
1346
 
1359
1347
  # Goes to directory bookmarked with number or upper case char.
1360
1348
  # If lower case character given, then go to first file starting with char.
1361
- def goto_bookmark(key = nil)
1349
+ def goto_bookmark key=nil
1362
1350
  unless key
1363
- last_line
1351
+ clear_last_line
1364
1352
  print 'Enter bookmark char: '
1365
1353
  key = get_char
1366
1354
  end
1367
- if key =~ /^[0-9A-Z]$/
1368
- d = $bookmarks[key]
1369
- if d
1370
- change_dir d
1371
- else
1372
- perror "#{key} not a bookmark"
1373
- end
1355
+ d = $bookmarks[key]
1356
+ if d
1357
+ change_dir d
1374
1358
  else
1375
- # goto_entry_starting_with key
1376
- file_starting_with key
1359
+ perror "#{key} not a bookmark. "
1377
1360
  end
1378
1361
  end
1379
1362
 
@@ -1480,7 +1463,7 @@ def view_bookmarks
1480
1463
  puts
1481
1464
  print 'Enter bookmark to goto: '
1482
1465
  key = get_char
1483
- goto_bookmark(key) if key =~ /^[0-9A-Z]$/
1466
+ goto_bookmark(key)
1484
1467
  end
1485
1468
 
1486
1469
  # MENU MAIN
@@ -1575,7 +1558,7 @@ def toggle_menu
1575
1558
  '*' => :toggle_selection_mode,
1576
1559
  v: :visual_mode_toggle,
1577
1560
  t: :toggle_truncate_from,
1578
- :e => :toggle_enhanced_list
1561
+ e: :toggle_enhanced_list
1579
1562
  }
1580
1563
 
1581
1564
  _, menu_text = menu 'Toggle Menu', h
@@ -1656,8 +1639,8 @@ def toggle_menu
1656
1639
  else
1657
1640
  :center
1658
1641
  end
1642
+ message "Truncate long filenames from: #{@truncate_from}"
1659
1643
  end
1660
- message "Truncate long filenames from: #{@truncate_from}"
1661
1644
  end
1662
1645
 
1663
1646
  def order_menu
@@ -1954,17 +1937,18 @@ end
1954
1937
  ## accept a character to save this dir as a bookmark
1955
1938
  def create_bookmark
1956
1939
 
1957
- print 'Enter A to Z or 0-9 to create a bookmark: '
1940
+ clear_last_line
1941
+ print 'Enter A-Z, a-z or 0-9 to create a bookmark: '
1958
1942
  # print "\e[?25h" # unhide cursor
1959
1943
  key = get_char
1960
1944
  # print "\e[?25l" # hide cursor
1961
- if key =~ /^[0-9A-Z]$/
1945
+ if key =~ /^[0-9A-Za-z]$/
1962
1946
  # $bookmarks[key] = "#{Dir.pwd}:#{$cursor}"
1963
1947
  set_bookmark key
1964
1948
  $modified = true
1965
- message "Created bookmark #{key}"
1949
+ message "Created bookmark #{key} for #{File.basename(Dir.pwd)}."
1966
1950
  else
1967
- perror 'Bookmark must be upper-case character or number.'
1951
+ perror 'Bookmark must be alpha character or number.'
1968
1952
  end
1969
1953
  # redraw
1970
1954
  end
@@ -2121,8 +2105,7 @@ end
2121
2105
  # but prints on next line.FIXME 2019-03-24 - 00:08
2122
2106
  def perror text
2123
2107
  clear_last_line
2124
- last_line
2125
- print "#{RED}#{text}. Press a key.#{CLEAR}"
2108
+ print "\r#{RED}#{text}. Press a key.#{CLEAR}"
2126
2109
  get_char
2127
2110
  end
2128
2111
 
@@ -2746,10 +2729,12 @@ def visual_block_clear
2746
2729
  end
2747
2730
 
2748
2731
  # ------------- file matching methods --------------------------------#
2749
- # this is a bit silly because it only works with lower case chars, we
2750
- # cannot get to files starting with numbers or uppercase since it is not
2751
- # called in those cases !!
2752
- def file_starting_with first_char
2732
+ def file_starting_with first_char=nil
2733
+ unless first_char
2734
+ clear_last_line
2735
+ print "\rEnter first char: "
2736
+ first_char = get_char
2737
+ end
2753
2738
  ix = return_next_match(method(:file_matching?), "^#{first_char}")
2754
2739
  goto_line ix if ix
2755
2740
  end
@@ -3244,7 +3229,8 @@ def clear_last_line
3244
3229
  # \e[33;41m - set color of status_line
3245
3230
  # %*s - set blank spaces for entire line
3246
3231
  # \e[m - reset text mode
3247
- print "\e[33;4%sm%*s\e[m" % [$status_color || '1', $gcols, " "]
3232
+ # \r - bring to start of line since callers will print.
3233
+ print "\e[33;4%sm%*s\e[m\r" % [$status_color || '1', $gcols, " "]
3248
3234
  end
3249
3235
 
3250
3236
  # print right aligned
data/cetus.gemspec CHANGED
@@ -6,7 +6,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
6
6
 
7
7
  Gem::Specification.new do |spec|
8
8
  spec.name = 'cetus'
9
- spec.version = '0.1.33'
9
+ spec.version = '0.1.34'
10
10
  spec.authors = ['Rahul Kumar']
11
11
  spec.email = ['oneness.univ@gmail.com']
12
12
  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.33
4
+ version: 0.1.34
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rahul Kumar