jump 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/Changelog CHANGED
@@ -1,3 +1,14 @@
1
+ Wed Feb 06 09:08:54 CET 2013 Flavio Castelli <flavio@castelli.name>
2
+
3
+ Version 0.3.1:
4
+ * exit with a nonzero value for unknown bookmarks.
5
+
6
+ Wed Mar 07 11:15:01 CET 2012 Flavio Castelli <flavio@castelli.name>
7
+
8
+ Version 0.3.0:
9
+ * better output when listing bookmarks.
10
+ * added --bash-integration and --zsh-integration help tasks.
11
+
1
12
  Sat Aug 28 09:04:30 CEST 2010 Flavio Castelli <flavio@castelli.name>
2
13
 
3
14
  * added support to zsh
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.3.1
@@ -19,12 +19,15 @@
19
19
  # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20
20
 
21
21
  function jump {
22
+ local dest
22
23
  #echo "jump called with $*"
23
24
  if [ $# -lt 1 ]; then
24
25
  jump-bin --help
25
26
  elif [ ${1:0:1} == "-" ]; then
26
27
  jump-bin $*
27
28
  else
28
- cd "$(jump-bin $*)"
29
+ dest="$(jump-bin $*)" && cd "$dest"
29
30
  fi
30
31
  }
32
+
33
+ # vim: ft=sh et sw=2 ts=2 sts=2
@@ -28,7 +28,7 @@ require 'optparse'
28
28
 
29
29
  options = {}
30
30
  begin
31
- OptionParser.new do |opts|
31
+ opts = OptionParser.new do |opts|
32
32
  opts.banner = "Usage: jump [options] [BOOKMARK[/path/to/subfolder]]"
33
33
 
34
34
  opts.on("-a", "--add BOOKMARK", "Saves the current directory in BOOKMARK") do |v|
@@ -57,7 +57,8 @@ begin
57
57
  puts opts
58
58
  exit
59
59
  end
60
- end.parse!
60
+ end
61
+ opts.parse!
61
62
  rescue OptionParser::InvalidOption
62
63
  if $!.args.first == "--bc"
63
64
  # This is an hidden method used by bash_completion
@@ -72,6 +73,8 @@ end
72
73
 
73
74
  bookmarks = Bookmarks.new
74
75
 
76
+ ### handle options, if present
77
+
75
78
  if options.has_key?(:add)
76
79
  bookmarks.add(Dir.pwd, options[:add])
77
80
  bookmarks.save
@@ -87,16 +90,24 @@ if options.has_key?(:del)
87
90
  end
88
91
  end
89
92
 
90
- puts bookmarks if options.has_key?(:list)
91
- if ARGV.size == 1
92
- expanded_path = bookmarks.expand_path(ARGV[0])
93
- if expanded_path.nil?
94
- STDERR.puts "Unknown bookmark: '#{ARGV[0]}'."
95
- puts Dir.pwd
96
- else
97
- puts expanded_path
98
- end
99
- elsif ARGV.size > 1
100
- STDERR.puts "Wrong arguments."
101
- puts Dir.pwd
93
+ if options.has_key?(:list)
94
+ puts bookmarks
102
95
  end
96
+
97
+ exit if ARGV.empty?
98
+
99
+ ### remaining argument(s) must be a single bookmark
100
+
101
+ if ARGV.size > 1
102
+ STDERR.puts opts
103
+ exit 1
104
+ end
105
+
106
+ expanded_path = bookmarks.expand_path(ARGV[0])
107
+ if expanded_path.nil?
108
+ STDERR.puts "Unknown bookmark: '#{ARGV[0]}'."
109
+ exit 42
110
+ else
111
+ puts expanded_path
112
+ end
113
+
@@ -21,7 +21,7 @@ _jump()
21
21
  {
22
22
  local user_input
23
23
  read -cA user_input
24
- local cur prev
24
+ local cur prev
25
25
  reply=()
26
26
 
27
27
  cur="${user_input[$#user_input]}"
@@ -41,10 +41,11 @@ _jump()
41
41
  else
42
42
  reply=( $(jump-bin --bc ${cur}) )
43
43
  return 0
44
- fi
44
+ fi
45
45
  }
46
46
 
47
47
  function jump {
48
+ local args dest
48
49
  args=$*
49
50
  #echo "jump called with |$args|"
50
51
  if [[ $#args -lt 1 ]]; then
@@ -52,8 +53,10 @@ function jump {
52
53
  elif [[ ${args[0,1]} = "-" ]]; then
53
54
  jump-bin $*
54
55
  else
55
- cd "$(jump-bin $*)"
56
+ dest="$(jump-bin $*)" && cd "$dest"
56
57
  fi
57
58
  }
58
59
 
59
60
  compctl -K _jump -S '' jump
61
+
62
+ # vim: ft=zsh et sw=2 ts=2 sts=2
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jump
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-03-06 00:00:00.000000000 Z
13
+ date: 2013-02-06 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: terminal-table
17
- requirement: &70508760 !ruby/object:Gem::Requirement
17
+ requirement: !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,15 @@ dependencies:
22
22
  version: 1.4.4
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70508760
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: 1.4.4
26
31
  - !ruby/object:Gem::Dependency
27
32
  name: fakefs
28
- requirement: &70507740 !ruby/object:Gem::Requirement
33
+ requirement: !ruby/object:Gem::Requirement
29
34
  none: false
30
35
  requirements:
31
36
  - - ! '>='
@@ -33,7 +38,12 @@ dependencies:
33
38
  version: '0'
34
39
  type: :development
35
40
  prerelease: false
36
- version_requirements: *70507740
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
37
47
  description: ! "Jump is a tool that allows you to quickly change\n directories
38
48
  in the bash and zsh shells using bookmarks.\n Thanks to Jump,
39
49
  you won't have to type those long paths anymore.\n\n Jump
@@ -95,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
105
  version: '0'
96
106
  requirements: []
97
107
  rubyforge_project:
98
- rubygems_version: 1.8.15
108
+ rubygems_version: 1.8.23
99
109
  signing_key:
100
110
  specification_version: 3
101
111
  summary: A bookmarking system for bash and zsh shells