Show More
@@ -261,8 +261,6 b' class OSMagics(Magics):' | |||||
261 | /home/tsuser/parent/child |
|
261 | /home/tsuser/parent/child | |
262 | """ |
|
262 | """ | |
263 |
|
263 | |||
264 | #bkms = self.shell.persist.get("bookmarks",{}) |
|
|||
265 |
|
||||
266 | oldcwd = os.getcwdu() |
|
264 | oldcwd = os.getcwdu() | |
267 | numcd = re.match(r'(-)(\d+)$',parameter_s) |
|
265 | numcd = re.match(r'(-)(\d+)$',parameter_s) | |
268 | # jump in directory history by number |
|
266 | # jump in directory history by number | |
@@ -313,15 +311,15 b' class OSMagics(Magics):' | |||||
313 | raise UsageError('%cd -: No previous directory to change to.') |
|
311 | raise UsageError('%cd -: No previous directory to change to.') | |
314 | # jump to bookmark if needed |
|
312 | # jump to bookmark if needed | |
315 | else: |
|
313 | else: | |
316 |
if not os.path.isdir(ps) or |
|
314 | if not os.path.isdir(ps) or 'b' in opts: | |
317 | bkms = self.shell.db.get('bookmarks', {}) |
|
315 | bkms = self.shell.db.get('bookmarks', {}) | |
318 |
|
316 | |||
319 |
if bkms |
|
317 | if ps in bkms: | |
320 | target = bkms[ps] |
|
318 | target = bkms[ps] | |
321 | print '(bookmark:%s) -> %s' % (ps,target) |
|
319 | print '(bookmark:%s) -> %s' % (ps,target) | |
322 | ps = target |
|
320 | ps = target | |
323 | else: |
|
321 | else: | |
324 |
if |
|
322 | if 'b' in opts: | |
325 | raise UsageError("Bookmark '%s' not found. " |
|
323 | raise UsageError("Bookmark '%s' not found. " | |
326 | "Use '%%bookmark -l' to see your bookmarks." % ps) |
|
324 | "Use '%%bookmark -l' to see your bookmarks." % ps) | |
327 |
|
325 | |||
@@ -540,7 +538,7 b' class OSMagics(Magics):' | |||||
540 | # If all looks ok, proceed |
|
538 | # If all looks ok, proceed | |
541 | split = 'l' in opts |
|
539 | split = 'l' in opts | |
542 | out = self.shell.getoutput(cmd, split=split) |
|
540 | out = self.shell.getoutput(cmd, split=split) | |
543 |
if |
|
541 | if 'v' in opts: | |
544 | print '%s ==\n%s' % (var,pformat(out)) |
|
542 | print '%s ==\n%s' % (var,pformat(out)) | |
545 | if var: |
|
543 | if var: | |
546 | self.shell.user_ns.update({var:out}) |
|
544 | self.shell.user_ns.update({var:out}) | |
@@ -619,7 +617,7 b' class OSMagics(Magics):' | |||||
619 |
|
617 | |||
620 | bkms = self.shell.db.get('bookmarks',{}) |
|
618 | bkms = self.shell.db.get('bookmarks',{}) | |
621 |
|
619 | |||
622 |
if |
|
620 | if 'd' in opts: | |
623 | try: |
|
621 | try: | |
624 | todel = args[0] |
|
622 | todel = args[0] | |
625 | except IndexError: |
|
623 | except IndexError: | |
@@ -632,19 +630,19 b' class OSMagics(Magics):' | |||||
632 | raise UsageError( |
|
630 | raise UsageError( | |
633 | "%%bookmark -d: Can't delete bookmark '%s'" % todel) |
|
631 | "%%bookmark -d: Can't delete bookmark '%s'" % todel) | |
634 |
|
632 | |||
635 |
elif |
|
633 | elif 'r' in opts: | |
636 | bkms = {} |
|
634 | bkms = {} | |
637 |
elif |
|
635 | elif 'l' in opts: | |
638 | bks = bkms.keys() |
|
636 | bks = bkms.keys() | |
639 | bks.sort() |
|
637 | bks.sort() | |
640 | if bks: |
|
638 | if bks: | |
641 | size = max(map(len,bks)) |
|
639 | size = max(map(len, bks)) | |
642 | else: |
|
640 | else: | |
643 | size = 0 |
|
641 | size = 0 | |
644 | fmt = '%-'+str(size)+'s -> %s' |
|
642 | fmt = '%-'+str(size)+'s -> %s' | |
645 | print 'Current bookmarks:' |
|
643 | print 'Current bookmarks:' | |
646 | for bk in bks: |
|
644 | for bk in bks: | |
647 | print fmt % (bk,bkms[bk]) |
|
645 | print fmt % (bk, bkms[bk]) | |
648 | else: |
|
646 | else: | |
649 | if not args: |
|
647 | if not args: | |
650 | raise UsageError("%bookmark: You must specify the bookmark name") |
|
648 | raise UsageError("%bookmark: You must specify the bookmark name") |
General Comments 0
You need to be logged in to leave comments.
Login now