diru 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 98c77992c8442b0030204aaa25ec19998e00a27b
4
- data.tar.gz: 53fcbf64b69f57b62028be1d1c4adc01d8484b4f
3
+ metadata.gz: 2c23e4327dec6a0eaae3ea4c5c06f2fc15b4f2df
4
+ data.tar.gz: cecf0ff254e79974d0c869af0d8728d2d1e955e4
5
5
  SHA512:
6
- metadata.gz: 3fec1c06357e15b0128ceb7301ee54825205a36b056af0e5f48881d747b0b1156198e856c7c9ba37dd0ccb9af91775d11f7bdbd3258fc1bf70a99dbd20a5b4cb
7
- data.tar.gz: 635d80fe66b08b5bae9697c0616f32719111284363e87400ae6195015a8bb5fa38db56e0a38ab12d0062a201e8444e131a1ac8eb323e39b40c80d68c8994e61b
6
+ metadata.gz: f08708b3e339cd373ede6fe3bb53190e0c3effc8aee658f17e35766f52a3e1da9ed648013d519cd5b5e7d26f4071ecb865d1efe19f7cc9d166d0b327ce06b489
7
+ data.tar.gz: 84c60360b2271037a8204dfefc490fca6a9d1d0a86ee37a830f3bb3ab534605a7297366ad4e32c30bf79038e8d3189cdfae95153b767b373b34304697586f99d
@@ -1,5 +1,11 @@
1
1
  = Version history
2
2
 
3
+ [0.0.6] Bookmarks stored newest first.
4
+ Allow sequence of commands ("+").
5
+ Improved README doc.
6
+ Document option.
7
+ Removed character based commands.
8
+
3
9
  [0.0.5] Query only command.
4
10
  User (ID) based server separation.
5
11
 
@@ -9,13 +9,14 @@
9
9
  = Introduction
10
10
 
11
11
  Diru is a Change Directory (cd) utility for augmenting Unix Shell
12
- functionality. Diru uses server/client architecture, which enables
13
- sharing of directory info between terminal sessions.
12
+ functionality. Diru makes it easy and efficient to jump around in
13
+ Project's directories. Diru uses server/client architecture, which
14
+ enables sharing of directory info and state between terminal sessions.
14
15
 
15
- Each Server serves one Project, which is a tree of related directories
16
- where user wants to jump around and which has a logical root. There
17
- can be multiple Servers, if user needs to access multiple Projects
18
- concurrently.
16
+ Each Server serves one Project. Project is a tree of related
17
+ directories where user wants to jump around and which has a logical
18
+ root. There can be multiple Servers, if user needs to access multiple
19
+ Projects concurrently.
19
20
 
20
21
  Client queries directory info from Server and directory change is
21
22
  pushed to Shell in order to change the current directory within
@@ -91,10 +92,10 @@ Here is an example of such function for Bourne Shell based shells:
91
92
  fi
92
93
  }
93
94
 
94
- Diru Client command is called now "dr". We specify with "-p" that port
95
- "42324" is used towards the Server and with "-c" that we want to issue
96
- directory "change" commands. In practice only part of the commands
97
- will change directory, since some commands are only for
95
+ Diru Client command is called now "dr". We specify with "-p" option,
96
+ that port "42324" is used towards the Server and with "-c" that we
97
+ want to issue directory "change" commands. In practice only part of
98
+ the commands will change directory, since some commands are only for
98
99
  queries. Directory is (and should be) changed if Diru returns
99
100
  0. Otherwise Diru is performing a non-cd command, and Shell should
100
101
  just ignore the current Diru execution.
@@ -125,6 +126,14 @@ to previous dir, we do:
125
126
 
126
127
  shell> dr h 0
127
128
 
129
+ Bookmarks have also the same type of number based referencing.
130
+
131
+ User can create a command sequence by separating commands with ","
132
+ character. For example if you want to reference Scratch Pad and then
133
+ jump to Peer, you can do:
134
+
135
+ shell> dr s , p
136
+
128
137
 
129
138
  = Client commands
130
139
 
@@ -133,66 +142,63 @@ info from Server.
133
142
 
134
143
  Search commands:
135
144
 
136
- * "dr r" - change to Project root dir.
137
- * "dr r <dir>" - change to <dir> (somewhere) under Project root dir
145
+ * "dr r" - change to Project root dir.
146
+ * "dr r <dir>" - change to <dir> (somewhere) under Project root dir
138
147
  (glob).
139
- * "dr t <dir>" - change to <dir> (somewhere) under current dir (glob).
140
- * "dr e <dir>" - change to <dir> (somewhere) under Project root dir
148
+ * "dr t <dir>" - change to <dir> (somewhere) under current dir (glob).
149
+ * "dr e <dir>" - change to <dir> (somewhere) under Project root dir
141
150
  (regexp).
142
151
 
143
152
  Search can match to multiple directories. First match is used and the
144
153
  rest (Left-overs) are displayed to the user. Left-overs are also
145
154
  stored, and they can be referenced and used in order of appearance
146
- with simply issuing "dr".
155
+ with simply issuing "dr" again.
147
156
 
148
- Search pattern can also be constructed from multiple pieces.
157
+ Search pattern can be constructed from multiple pieces.
149
158
 
150
159
  shell> dr r dir 1_0_1
151
160
 
152
161
  The pieces are joined with '*' for glob (fnmatch) based searches and
153
162
  with '.*' for regexp based searches. Glob based searches are
154
- additionally prefixed with '*' and postfixed with '*', since glob does
155
- not automatically match to the middle of the string, however regexp does.
156
-
157
- See "dr i" for alternatives for single letter commands. For example
158
- "r" can be replaced with "/".
163
+ additionally pre-fixed with '*' and post-fixed with '*'. Glob does not
164
+ automatically match to the middle of the string, however regexp does.
159
165
 
160
166
 
161
167
  Bookmark commands:
162
168
 
163
- * "dr b" - display bookmarks.
164
- * "dr b ." - add current dir to bookmarks.
165
- * "dr b !" - reset (clear) bookmarks.
166
- * "dr b s <file>" - store bookmarks to <file>.
167
- * "dr b l <file>" - load bookmarks from <file>.
168
- * "dr b d <num>" - delete bookmark with <num>.
169
- * "dr b <num>" - change dir to bookmark <num>.
169
+ * "dr b" - display bookmarks.
170
+ * "dr b ." - add current dir to bookmarks.
171
+ * "dr b !" - reset (clear) bookmarks.
172
+ * "dr b s <file>" - store bookmarks to <file>.
173
+ * "dr b l <file>" - load bookmarks from <file>.
174
+ * "dr b d <num>" - delete bookmark with <num>.
175
+ * "dr b <num>" - change dir to bookmark <num>.
170
176
 
171
177
  History commands:
172
178
 
173
- * "dr h" - display history.
174
- * "dr h ." - add current dir to history.
175
- * "dr h !" - reset (clear) history.
176
- * "dr h ," - reference last history item.
177
- * "dr h <num>" - change dir to history <num>.
179
+ * "dr h" - display history.
180
+ * "dr h ." - add current dir to history.
181
+ * "dr h !" - reset (clear) history.
182
+ * "dr h ," - reference last history item.
183
+ * "dr h <num>" - change dir to history <num>.
178
184
 
179
185
  Scratch Pad commands:
180
186
 
181
- * "dr s ." - store current dir to Scratch Pad.
182
- * "dr s <dir>" - store <dir> to Scratch Pad.
183
- * "dr s" - change dir to Scratch Pad dir.
187
+ * "dr s ." - store current dir to Scratch Pad.
188
+ * "dr s <dir>" - store <dir> to Scratch Pad.
189
+ * "dr s" - change dir to Scratch Pad dir.
184
190
 
185
191
  Misc commands:
186
192
 
187
- * "dr p" - jump to peer dir, i.e. the peer of current (from options).
188
- * "dr c <cmd>" - issue RPC command to server (reset etc., see below).
189
- * "dr f" - list favorites dirs (from options).
190
- * "dr f <dir>" - change dir to favorite <dir>.
191
- * "dr d m <dir>" - make directory.
192
- * "dr d r <dir>" - remove directory.
193
- * "dr i" - show command info.
194
- * "dr <dir>" - change to given dir (must be under current).
195
- * "dr" - change to next "Left-over" directory.
193
+ * "dr p" - jump to peer dir, i.e. the peer of current (from options).
194
+ * "dr c <cmd>" - issue RPC command to server (reset etc., see below).
195
+ * "dr f" - list favorites dirs (from options).
196
+ * "dr f <dir>" - change dir to favorite <dir>.
197
+ * "dr d m <dir>" - make directory.
198
+ * "dr d r <dir>" - remove directory.
199
+ * "dr i" - show command info.
200
+ * "dr <dir>" - change to given dir (must be under current).
201
+ * "dr" - change to next "Left-over" directory.
196
202
 
197
203
  RPC (Remote Procedure Call) commands:
198
204
 
@@ -210,11 +216,12 @@ RPC (Remote Procedure Call) commands:
210
216
  Diru uses several environment variables, which are optional, and
211
217
  provides thereby backup values for non-specified command line info.
212
218
 
213
- * DIRU_HUB_PORT - Hub Port, if nothing, 41114 is used.
214
- * DIRU_PORT - Server Port, if nothing, ~/.diru.prt is used (Port File).
215
- * DIRU_OPTS - options file, if nothing, ~/.diru.yml is used.
216
- * DIRU_ROOT - Project root, used if ".diru_root_dir" and ".diru.yml"
217
- are missing.
219
+ * DIRU_HUB_PORT - Hub Port, if nothing, 41114 is used.
220
+ * DIRU_PORT - Server Port, if nothing, ~/.diru.prt is used
221
+ (Port File).
222
+ * DIRU_OPTS - options file, if nothing, ~/.diru.yml is used.
223
+ * DIRU_ROOT - Project root, used if ".diru_root_dir" and
224
+ ".diru.yml" are missing.
218
225
 
219
226
  If Hub is started without "--hport" option, Diru checks if
220
227
  DIRU_HUB_PORT is defined. If not, port 41114 is used.
@@ -241,19 +248,23 @@ An example Options file can be displayed with:
241
248
 
242
249
  Available options in Options File:
243
250
 
244
- * :sync - Options File and Project directory hierarchy refresh period
245
- in seconds (for Server).
251
+ * :sync - Options File and Project directory hierarchy refresh period
252
+ in seconds (for Server).
253
+
246
254
  * :dsync - Project directory hierarchy refresh period. This overrides
247
- ":sync" for Project updates (only). If value is 0, then no updates
248
- are done after initial update when Server starts. User might want to
249
- use 0, if the directory hierarchy is big and/or does not change
250
- (often).
251
- * :hist - number of entries in history (max).
252
- * :favs - tagged favorite dirs.
255
+ ":sync" for Project updates (only). If value is 0, then no
256
+ updates are done after initial update when Server
257
+ starts. User might want to use 0, if the directory
258
+ hierarchy is big and/or does not change (often).
259
+
260
+ * :hist - number of entries in history (max).
261
+
262
+ * :favs - tagged favorite dirs.
263
+
253
264
  * :peers - <regexp>,<str> pairs for peer matching (String#sub method).
254
265
 
255
266
 
256
- = Practical usage
267
+ = Practical usage tips
257
268
 
258
269
  After Hub has been started, user can start Server for each
259
270
  Project. Each Server runs on its own Port, and user can either define
@@ -262,8 +273,8 @@ environment variable (DIRU_PORT) and change it according to
262
273
  Project. Depending on the usage pattern, user might as well want to
263
274
  use the Port File.
264
275
 
265
- Each Project could benefit from specific Options File, and thus user
266
- could mark the Project Root with ".diru.yml" and specify the Project
276
+ Each Project could benefit from specific Options File, and hence user
277
+ can mark the Project Root with ".diru.yml" and specify the Project
267
278
  setup there.
268
279
 
269
280
  Server caches all Project directory entries from disk to memory. This
@@ -281,8 +292,8 @@ assume user starts with editing source code and has a terminal for
281
292
  accessing files. When program is ready for running, user opens a new
282
293
  terminal for handling the compile-run-debug iterations.
283
294
 
284
- User can copy source terminal directory to Scratch Pad. Then in the
285
- new terminal, user can refer to Scratch Pad and change to same
295
+ User can copy current source terminal directory to Scratch Pad. Then
296
+ in the new terminal, user can refer to Scratch Pad and change to same
286
297
  directory as in source terminal. Finally user can change to a Peer of
287
298
  current dir, i.e. where program running and debugging takes place.
288
299
 
data/bin/diru CHANGED
@@ -81,6 +81,7 @@ Spec.command( 'diru', 'Tero Isannainen', '2017',
81
81
  [ :opt_single, 'port', '-p', "SC: Server port for client (default: DIRU_PORT or ~/.diru.prt)." ],
82
82
  [ :switch, 'change', '-c', "C: Change dir (i.e. target is to change dir)." ],
83
83
  [ :exclusive, 'template', '-t', "C: Display Options File template." ],
84
+ [ :exclusive, 'cmddoc', '-d', "C: Display command documentation." ],
84
85
  [ :default, nil, nil, "C: Client commands (try: diru i)." ],
85
86
  ] )
86
87
 
@@ -131,11 +132,13 @@ module Diru
131
132
  Dir.glob( "#{dir}/#{glob}" )
132
133
  end
133
134
 
135
+
134
136
  # List the dir files (default: pwd).
135
137
  def Diru.list_files( dir = '.', glob = '*' )
136
138
  Diru.list( dir, glob ).select do |i| File.file?(i) == true end
137
139
  end
138
140
 
141
+
139
142
  # Find file entry from directory hierarchy upwards.
140
143
  def Diru.find_upper_file( file, dir = Dir.pwd )
141
144
  found = Diru.list_files( dir, file )
@@ -276,7 +279,7 @@ class Search
276
279
  def abook( dir )
277
280
  idx = @book.index dir
278
281
  unless idx
279
- @book.push dir
282
+ @book.unshift dir
280
283
  end
281
284
  end
282
285
 
@@ -792,6 +795,59 @@ if Opt['template'].given
792
795
  end
793
796
 
794
797
 
798
+ # Keep in sync with README.
799
+ if Opt['cmddoc'].given
800
+ STDERR.puts %q{
801
+ Search commands:
802
+
803
+ * "dr r" - change to Project root dir.
804
+ * "dr r <dir>" - change to <dir> (somewhere) under Project root dir
805
+ (glob).
806
+ * "dr t <dir>" - change to <dir> (somewhere) under current dir (glob).
807
+ * "dr e <dir>" - change to <dir> (somewhere) under Project root dir
808
+ (regexp).
809
+
810
+ Bookmark commands:
811
+
812
+ * "dr b" - display bookmarks.
813
+ * "dr b ." - add current dir to bookmarks.
814
+ * "dr b !" - reset (clear) bookmarks.
815
+ * "dr b s <file>" - store bookmarks to <file>.
816
+ * "dr b l <file>" - load bookmarks from <file>.
817
+ * "dr b d <num>" - delete bookmark with <num>.
818
+ * "dr b <num>" - change dir to bookmark <num>.
819
+
820
+ History commands:
821
+
822
+ * "dr h" - display history.
823
+ * "dr h ." - add current dir to history.
824
+ * "dr h !" - reset (clear) history.
825
+ * "dr h ," - reference last history item.
826
+ * "dr h <num>" - change dir to history <num>.
827
+
828
+ Scratch Pad commands:
829
+
830
+ * "dr s ." - store current dir to Scratch Pad.
831
+ * "dr s <dir>" - store <dir> to Scratch Pad.
832
+ * "dr s" - change dir to Scratch Pad dir.
833
+
834
+ Misc commands:
835
+
836
+ * "dr p" - jump to peer dir, i.e. the peer of current (from options).
837
+ * "dr c <cmd>" - issue RPC command to server (reset etc., see below).
838
+ * "dr f" - list favorites dirs (from options).
839
+ * "dr f <dir>" - change dir to favorite <dir>.
840
+ * "dr d m <dir>" - make directory.
841
+ * "dr d r <dir>" - remove directory.
842
+ * "dr i" - show command info.
843
+ * "dr <dir>" - change to given dir (must be under current).
844
+ * "dr" - change to next "Left-over" directory.
845
+
846
+ }
847
+ exit( false )
848
+ end
849
+
850
+
795
851
  hport = nil
796
852
  if Opt['hport'].given
797
853
  hport = Opt['hport'].value.to_i
@@ -929,6 +985,9 @@ class Client
929
985
 
930
986
  include Diru
931
987
 
988
+ attr_reader :pwd
989
+ attr_accessor :enable_out
990
+
932
991
  def initialize( port )
933
992
 
934
993
  @port = port
@@ -938,12 +997,27 @@ class Client
938
997
  @search = DRbObject.new( nil, "druby://localhost:#{@port}" )
939
998
 
940
999
  load_conf( @search.opts_file )
1000
+
1001
+ @pwd = Dir.pwd
1002
+
1003
+ @enable_out = true
1004
+
941
1005
  end
942
1006
 
943
1007
 
944
1008
  # Perform cd (i.e. return true) and store current dir to history.
945
- def do_cd
946
- @search.ahist( Dir.pwd )
1009
+ def do_cd( dir )
1010
+
1011
+ # Store current to history before change.
1012
+ @search.ahist( @pwd )
1013
+
1014
+ # Local copy of new dir for command-sequence mode.
1015
+ @pwd = dir
1016
+
1017
+ # Directory info for shell, unless disabled for
1018
+ # command-sequence mode.
1019
+ puts dir if @enable_out
1020
+
947
1021
  true
948
1022
  end
949
1023
 
@@ -960,8 +1034,7 @@ class Client
960
1034
  if input.empty?
961
1035
 
962
1036
  # Refer to last search list.
963
- puts @search.next
964
- do_cd
1037
+ do_cd @search.next
965
1038
 
966
1039
  else
967
1040
 
@@ -979,25 +1052,25 @@ class Client
979
1052
  ret = \
980
1053
  case cmd
981
1054
 
982
- when '/', 'r';
1055
+ when 'r';
983
1056
  if arg.empty?
984
1057
  disp @search.root
985
1058
  else
986
1059
  disp @search.match( nil, "*"+arg.join('*')+"*" )
987
1060
  end
988
1061
 
989
- when ':', 't'; disp @search.match( Dir.pwd, "*"+arg.join('*')+"*" )
1062
+ when 't'; disp @search.match( @pwd, "*"+arg.join('*')+"*" )
990
1063
 
991
1064
  when 'e'; disp @search.rematch( nil, arg.join('.*') )
992
1065
 
993
1066
  when 'q'; disp @search.rematch( nil, arg.join('.*') )
994
1067
 
995
- when '.', 'b';
1068
+ when 'b';
996
1069
  if arg[0] == nil
997
1070
  lbook( @search.book )
998
1071
  no_cd
999
1072
  elsif arg[0] == '.'
1000
- @search.abook( Dir.pwd )
1073
+ @search.abook( @pwd )
1001
1074
  no_cd
1002
1075
  elsif arg[0] == '!'
1003
1076
  @search.rbook
@@ -1015,12 +1088,12 @@ class Client
1015
1088
  disp @search.gbook( arg[0].to_i )
1016
1089
  end
1017
1090
 
1018
- when ',', 'h';
1091
+ when 'h';
1019
1092
  if arg[0] == nil
1020
1093
  lbook( @search.hist )
1021
1094
  no_cd
1022
1095
  elsif arg[0] == '.'
1023
- @search.ahist( Dir.pwd )
1096
+ @search.ahist( @pwd )
1024
1097
  no_cd
1025
1098
  elsif arg[0] == '!'
1026
1099
  @search.rhist
@@ -1031,12 +1104,12 @@ class Client
1031
1104
  disp @search.ghist( arg[0].to_i )
1032
1105
  end
1033
1106
 
1034
- when '_', 's';
1107
+ when 's';
1035
1108
  if arg[0] == nil
1036
1109
  disp @search.gettmp
1037
1110
  elsif arg[0]
1038
1111
  if arg[0] == '.'
1039
- dir = Dir.pwd
1112
+ dir = @pwd
1040
1113
  else
1041
1114
  dir = arg[0]
1042
1115
  end
@@ -1046,9 +1119,9 @@ class Client
1046
1119
  no_cd
1047
1120
  end
1048
1121
 
1049
- when '=', 'p'; disp peer
1122
+ when 'p'; disp peer
1050
1123
 
1051
- when '@', 'c'; rpc( arg )
1124
+ when 'c'; rpc( arg )
1052
1125
 
1053
1126
  when 'f';
1054
1127
  if arg[0] == nil
@@ -1093,15 +1166,15 @@ class Client
1093
1166
 
1094
1167
  if Opt['change'].given
1095
1168
  all = [cmd] + arg
1096
- puts "#{all.join(' ')}"
1097
- do_cd
1169
+ do_cd "#{all.join(' ')}"
1098
1170
  else
1099
1171
  no_cd
1100
1172
  end
1101
1173
 
1102
1174
  end
1103
1175
 
1104
- exit( ret )
1176
+ # exit( ret )
1177
+ return ret
1105
1178
  end
1106
1179
 
1107
1180
  end
@@ -1113,20 +1186,18 @@ class Client
1113
1186
  no_cd
1114
1187
  elsif resp.kind_of? Array
1115
1188
  if resp.any?
1116
- puts resp[0]
1117
1189
  if resp.length > 1
1118
1190
  resp[1..-1].each do |i|
1119
1191
  STDERR.puts i
1120
1192
  end
1121
1193
  end
1122
- do_cd
1194
+ do_cd resp[0]
1123
1195
  else
1124
1196
  Diru.warn "Dir not found!"
1125
1197
  no_cd
1126
1198
  end
1127
1199
  else
1128
- puts resp
1129
- do_cd
1200
+ do_cd resp
1130
1201
  end
1131
1202
  end
1132
1203
 
@@ -1152,7 +1223,8 @@ class Client
1152
1223
  # pair, and switch to the pair dir.
1153
1224
  #
1154
1225
  def peer
1155
- cur = Dir.pwd
1226
+ # cur = Dir.pwd
1227
+ cur = @pwd
1156
1228
  peers = @conf[ :peers ]
1157
1229
  peers.each do |pair|
1158
1230
  re = Regexp.new( pair[0] )
@@ -1167,23 +1239,23 @@ class Client
1167
1239
  # Display short command doc.
1168
1240
  def doc
1169
1241
  STDERR.puts "
1170
- r / - search from root (or to root)
1171
- t : - search from this (current)
1172
- e - search from root (with regexp)
1173
- q - query from root (with regexp)
1174
- b . - bookmark access
1175
- h , - history access
1176
- s _ - scratch pad access
1177
- p = - peer of current
1178
- c @ - command (reset, doc etc.)
1179
- f - favorites
1180
- d - directory mutation
1181
- i - short info
1242
+ r - search from root (or to root)
1243
+ t - search from this (current)
1244
+ e - search from root (with regexp)
1245
+ q - query from root (with regexp)
1246
+ b - bookmark access
1247
+ h - history access
1248
+ s - scratch pad access
1249
+ p - peer of current
1250
+ c - command (reset, doc etc.)
1251
+ f - favorites
1252
+ d - directory mutation
1253
+ i - short info
1182
1254
  "
1183
1255
  end
1184
1256
 
1185
1257
 
1186
- # List bookmarks with index number (in reverse order).
1258
+ # List bookmarks with index number, in reverse order.
1187
1259
  def lbook( book )
1188
1260
  idx = book.length-1
1189
1261
  (0..idx).to_a.reverse.each do |i|
@@ -1200,7 +1272,7 @@ class Client
1200
1272
  def rpc( arg )
1201
1273
  case arg[0]
1202
1274
  when 'reset'; @search.reset
1203
- when 'abook'; @search.abook( Dir.pwd )
1275
+ when 'abook'; @search.abook( @pwd )
1204
1276
  when 'lbook'; lbook( @search.book )
1205
1277
  when 'rbook'; @search.rbook
1206
1278
  when 'doc'; doc
@@ -1217,7 +1289,6 @@ class Client
1217
1289
  ret = @search.gfav( arg[0] )
1218
1290
  if ret
1219
1291
  disp ret
1220
- do_cd
1221
1292
  else
1222
1293
  no_cd
1223
1294
  end
@@ -1247,12 +1318,42 @@ rescue
1247
1318
  exit( false )
1248
1319
  end
1249
1320
 
1321
+
1322
+ # Collect command-sequence (if any).
1323
+ cmds = []
1324
+ si = 0
1325
+ ei = 0
1326
+ while ( ei = input.index "," )
1327
+ cmds.push input[si...ei]
1328
+ si = ei+1
1329
+ input = input[si..-1]
1330
+ end
1331
+
1332
+ # Add the tail command, i.e. the only if no "+" used.
1333
+ cmds.push input
1334
+
1250
1335
  ret = false
1251
- begin
1252
- ret = client.command( input )
1253
- rescue
1254
- Diru.error "Command failure!"
1255
- exit( false )
1336
+
1337
+
1338
+ # Disable shell output for all dir changes except last.
1339
+ if cmds.length > 1
1340
+ client.enable_out = false
1341
+ end
1342
+
1343
+ cmds.each_with_index do |cmd, i|
1344
+
1345
+ if i == cmds.length-1
1346
+ # Enable output for shell for the last dir change.
1347
+ client.enable_out = true
1348
+ end
1349
+
1350
+ begin
1351
+ ret = client.command( cmd )
1352
+ rescue
1353
+ Diru.error "Command failure!"
1354
+ exit( false )
1355
+ end
1356
+
1256
1357
  end
1257
1358
 
1258
1359
  exit( ret )
@@ -1,5 +1,5 @@
1
1
  module Diru
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  def Diru.version
4
4
  Diru::VERSION
5
5
  end
@@ -68,14 +68,14 @@
68
68
  /home/tero/prog/gem/diru/test/dir_0/dir_0_4/dir_0_4_2
69
69
  /home/tero/prog/gem/diru/test/dir_0
70
70
  /home/tero/prog/gem/diru/test/dir_0
71
- 1: /home/tero/prog/gem/diru/test/dir_0
72
- 0: /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
71
+ 1: /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
72
+ 0: /home/tero/prog/gem/diru/test/dir_0
73
73
  /home/tero/prog/gem/diru/test/dir_0
74
74
  /home/tero/prog/gem/diru/test/dir_0
75
- 0: /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
75
+ 0: /home/tero/prog/gem/diru/test/dir_0
76
76
  /home/tero/prog/gem/diru/test/dir_0
77
77
  /home/tero/prog/gem/diru/test/dir_0
78
- 0: /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
78
+ 0: /home/tero/prog/gem/diru/test/dir_0
79
79
  /home/tero/prog/gem/diru/test/dir_0
80
80
  /home/tero/prog/gem/diru/test/dir_0
81
81
  /home/tero/prog/gem/diru/test/dir_0
@@ -104,49 +104,46 @@
104
104
  /home/tero/prog/gem/diru/test/dir_0/dir_0_4/dir_0_4_2
105
105
  /home/tero/prog/gem/diru/test/dir_0
106
106
  /home/tero/prog/gem/diru/test/dir_0
107
- 1: /home/tero/prog/gem/diru/test/dir_0
108
- 0: /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
107
+ 1: /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
108
+ 0: /home/tero/prog/gem/diru/test/dir_0
109
+ /home/tero/prog/gem/diru/test/dir_0
109
110
  /home/tero/prog/gem/diru/test/dir_0
110
- /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
111
- /home/tero/prog/gem/diru/test
112
111
  /home/tero/prog/gem/diru/test
113
112
  /home/tero/prog/gem/diru/test
114
113
  /home/tero/prog/gem/diru/test
115
114
  /home/tero/prog/gem/diru/test
116
- 1: /home/tero/prog/gem/diru/test/dir_0
117
- 0: /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
118
115
  /home/tero/prog/gem/diru/test
119
- /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
120
- 13: /home/tero/prog/gem/diru/test
121
- 12: /home/tero/prog/gem/diru/test/dir_0/dir_0_4/dir_0_4_0
122
- 11: /home/tero/prog/gem/diru/test/dir_1
123
- 10: /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_0
124
- 9: /home/tero/prog/gem/diru/test/dir_1/dir_1_1
125
- 8: /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
126
- 7: /home/tero/prog/gem/diru/test
127
- 6: /home/tero/prog/gem/diru/test/dir_0/dir_0_2/dir_0_2_0
128
- 5: /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
129
- 4: /home/tero/prog/gem/diru/test/dir_0
130
- 3: /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
131
- 2: /home/tero/prog/gem/diru/test/dir_0
132
116
  1: /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
133
- 0: /home/tero/prog/gem/diru/test
134
- /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
135
- /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
117
+ 0: /home/tero/prog/gem/diru/test/dir_0
136
118
  /home/tero/prog/gem/diru/test
137
- /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
119
+ /home/tero/prog/gem/diru/test/dir_0
120
+ 12: /home/tero/prog/gem/diru/test
121
+ 11: /home/tero/prog/gem/diru/test/dir_0/dir_0_4/dir_0_4_0
122
+ 10: /home/tero/prog/gem/diru/test/dir_1
123
+ 9: /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_0
124
+ 8: /home/tero/prog/gem/diru/test/dir_1/dir_1_1
125
+ 7: /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
126
+ 6: /home/tero/prog/gem/diru/test
127
+ 5: /home/tero/prog/gem/diru/test/dir_0/dir_0_2/dir_0_2_0
128
+ 4: /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
129
+ 3: /home/tero/prog/gem/diru/test/dir_0
130
+ 2: /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
131
+ 1: /home/tero/prog/gem/diru/test/dir_0
132
+ 0: /home/tero/prog/gem/diru/test
138
133
  /home/tero/prog/gem/diru/test/dir_0
139
134
  /home/tero/prog/gem/diru/test/dir_0
140
135
  /home/tero/prog/gem/diru/test
141
136
  /home/tero/prog/gem/diru/test/dir_0
142
- /home/tero/prog/gem/diru/test/dir_0/dir_0_0/dir_0_0_0
143
- /home/tero/prog/gem/diru/test/dir_0/dir_0_0/dir_0_0_1
144
- /home/tero/prog/gem/diru/test/dir_0/dir_0_0/dir_0_0_2
145
- /home/tero/prog/gem/diru/test/dir_0/dir_0_0
146
- /home/tero/prog/gem/diru/test/dir_0/dir_0_0
137
+ /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
138
+ /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
147
139
  /home/tero/prog/gem/diru/test
148
- /home/tero/prog/gem/diru/test/dir_0/dir_0_0
149
- /home/tero/prog/gem/diru/test/dir_0/dir_0_0
140
+ /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
141
+ Diru Warning: Dir not found!
142
+ /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
143
+ /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
144
+ /home/tero/prog/gem/diru/test
145
+ /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
146
+ /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
150
147
  /home/tero/prog/gem/diru/test
151
148
  /home/tero/prog/gem/diru/test/dir_0/dir_0_2/dir_0_2_0
152
149
  /home/tero/prog/gem/diru/test/dir_0/dir_0_2
@@ -156,29 +153,27 @@ f dir_0/dir_0_4/dir_0_4_0
156
153
  g dir_1/dir_1_2
157
154
  /home/tero/prog/gem/diru/test/dir_0/dir_0_1/dir_0_1_1
158
155
  /home/tero/prog/gem/diru/test/dir_0/dir_0_4/dir_0_4_0
159
- 27: /home/tero/prog/gem/diru/test
160
- 26: /home/tero/prog/gem/diru/test/dir_0/dir_0_4/dir_0_4_0
161
- 25: /home/tero/prog/gem/diru/test/dir_1
162
- 24: /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_0
163
- 23: /home/tero/prog/gem/diru/test/dir_1/dir_1_1
164
- 22: /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
165
- 21: /home/tero/prog/gem/diru/test
166
- 20: /home/tero/prog/gem/diru/test/dir_0/dir_0_2/dir_0_2_0
167
- 19: /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
168
- 18: /home/tero/prog/gem/diru/test/dir_0
156
+ 25: /home/tero/prog/gem/diru/test
157
+ 24: /home/tero/prog/gem/diru/test/dir_0/dir_0_4/dir_0_4_0
158
+ 23: /home/tero/prog/gem/diru/test/dir_1
159
+ 22: /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_0
160
+ 21: /home/tero/prog/gem/diru/test/dir_1/dir_1_1
161
+ 20: /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
162
+ 19: /home/tero/prog/gem/diru/test
163
+ 18: /home/tero/prog/gem/diru/test/dir_0/dir_0_2/dir_0_2_0
169
164
  17: /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
170
165
  16: /home/tero/prog/gem/diru/test/dir_0
171
166
  15: /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
172
- 14: /home/tero/prog/gem/diru/test
173
- 13: /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
174
- 12: /home/tero/prog/gem/diru/test
175
- 11: /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
167
+ 14: /home/tero/prog/gem/diru/test/dir_0
168
+ 13: /home/tero/prog/gem/diru/test
169
+ 12: /home/tero/prog/gem/diru/test/dir_0
170
+ 11: /home/tero/prog/gem/diru/test
176
171
  10: /home/tero/prog/gem/diru/test/dir_0
177
- 9: /home/tero/prog/gem/diru/test
178
- 8: /home/tero/prog/gem/diru/test/dir_0
179
- 7: /home/tero/prog/gem/diru/test/dir_0/dir_0_0
172
+ 9: /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
173
+ 8: /home/tero/prog/gem/diru/test
174
+ 7: /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
180
175
  6: /home/tero/prog/gem/diru/test
181
- 5: /home/tero/prog/gem/diru/test/dir_0/dir_0_0
176
+ 5: /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
182
177
  4: /home/tero/prog/gem/diru/test
183
178
  3: /home/tero/prog/gem/diru/test/dir_0/dir_0_2/dir_0_2_0
184
179
  2: /home/tero/prog/gem/diru/test/dir_0/dir_0_2
@@ -208,29 +203,27 @@ g dir_1/dir_1_2
208
203
  /home/tero/prog/gem/diru/test/dir_0/dir_0_1/dir_0_1_0
209
204
  /home/tero/prog/gem/diru/test/dir_0/dir_0_1/dir_0_1_1
210
205
  /home/tero/prog/gem/diru/test/dir_0/dir_0_1/dir_0_1_2
211
- 32: /home/tero/prog/gem/diru/test
212
- 31: /home/tero/prog/gem/diru/test/dir_0/dir_0_4/dir_0_4_0
213
- 30: /home/tero/prog/gem/diru/test/dir_1
214
- 29: /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_0
215
- 28: /home/tero/prog/gem/diru/test/dir_1/dir_1_1
216
- 27: /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
217
- 26: /home/tero/prog/gem/diru/test
218
- 25: /home/tero/prog/gem/diru/test/dir_0/dir_0_2/dir_0_2_0
219
- 24: /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
220
- 23: /home/tero/prog/gem/diru/test/dir_0
206
+ 30: /home/tero/prog/gem/diru/test
207
+ 29: /home/tero/prog/gem/diru/test/dir_0/dir_0_4/dir_0_4_0
208
+ 28: /home/tero/prog/gem/diru/test/dir_1
209
+ 27: /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_0
210
+ 26: /home/tero/prog/gem/diru/test/dir_1/dir_1_1
211
+ 25: /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
212
+ 24: /home/tero/prog/gem/diru/test
213
+ 23: /home/tero/prog/gem/diru/test/dir_0/dir_0_2/dir_0_2_0
221
214
  22: /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
222
215
  21: /home/tero/prog/gem/diru/test/dir_0
223
216
  20: /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
224
- 19: /home/tero/prog/gem/diru/test
225
- 18: /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
226
- 17: /home/tero/prog/gem/diru/test
227
- 16: /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
217
+ 19: /home/tero/prog/gem/diru/test/dir_0
218
+ 18: /home/tero/prog/gem/diru/test
219
+ 17: /home/tero/prog/gem/diru/test/dir_0
220
+ 16: /home/tero/prog/gem/diru/test
228
221
  15: /home/tero/prog/gem/diru/test/dir_0
229
- 14: /home/tero/prog/gem/diru/test
230
- 13: /home/tero/prog/gem/diru/test/dir_0
231
- 12: /home/tero/prog/gem/diru/test/dir_0/dir_0_0
222
+ 14: /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
223
+ 13: /home/tero/prog/gem/diru/test
224
+ 12: /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
232
225
  11: /home/tero/prog/gem/diru/test
233
- 10: /home/tero/prog/gem/diru/test/dir_0/dir_0_0
226
+ 10: /home/tero/prog/gem/diru/test/dir_1/dir_1_1/dir_1_1_2
234
227
  9: /home/tero/prog/gem/diru/test
235
228
  8: /home/tero/prog/gem/diru/test/dir_0/dir_0_2/dir_0_2_0
236
229
  7: /home/tero/prog/gem/diru/test/dir_0/dir_0_2
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: diru
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tero Isannainen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-14 00:00:00.000000000 Z
11
+ date: 2017-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: como
@@ -25,9 +25,11 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.2.0
27
27
  description: |-
28
- Diru is a Change Directory (cd) utility for augmenting Unix Shell
29
- functionality. Diru uses server/client architecture, which enables
30
- sharing of directory info between terminal sessions.
28
+ Diru is a Change Directory (cd) utility for
29
+ augmenting Unix Shell functionality. Diru makes it easy and efficient
30
+ to jump around in Project's directories. Diru uses server/client
31
+ architecture, which enables sharing of directory info and state
32
+ between terminal sessions.
31
33
 
32
34
  Each Server serves one Project, which is a tree of related directories
33
35
  where user wants to jump around and which has a logical root. There