'url n' prints URL of item n
This commit is contained in:
parent
a8a0be4754
commit
d3734a9a26
19
av98.py
19
av98.py
|
@ -1482,8 +1482,25 @@ Use 'ls -l' to see URLs."""
|
||||||
|
|
||||||
@needs_gi
|
@needs_gi
|
||||||
def do_url(self, *args):
|
def do_url(self, *args):
|
||||||
"""Print URL of most recently visited item."""
|
"""Print the URL of an item.
|
||||||
|
'url' prints the URL of the most recently visited item.
|
||||||
|
'url n' prints the URL of item n."""
|
||||||
|
# If no argument print current URL
|
||||||
|
if args[0] == '':
|
||||||
print(self.gi.url)
|
print(self.gi.url)
|
||||||
|
return
|
||||||
|
# If there is a valid integer argument print url of that item.
|
||||||
|
try:
|
||||||
|
n = int(args[0])
|
||||||
|
except ValueError:
|
||||||
|
print("Invalid item number.")
|
||||||
|
return
|
||||||
|
try:
|
||||||
|
gi = self.lookup[n-1]
|
||||||
|
except IndexError:
|
||||||
|
print ("Index too high!")
|
||||||
|
return
|
||||||
|
print(gi.url)
|
||||||
|
|
||||||
### Bookmarking stuff
|
### Bookmarking stuff
|
||||||
@restricted
|
@restricted
|
||||||
|
|
Loading…
Reference in New Issue