cp url X to copy the url of a link
This commit is contained in:
parent
4f4e1cc72c
commit
03f62d2e57
|
@ -1,7 +1,9 @@
|
||||||
# Offpunk History
|
# Offpunk History
|
||||||
|
|
||||||
## 1.1 - Unreleased
|
## 1.1 - Unreleased
|
||||||
|
- Perfect rendering of pictures with chafa 1.8+ and compatible terminal
|
||||||
- "cp cache" put the path of the cached content in clipboard
|
- "cp cache" put the path of the cached content in clipboard
|
||||||
|
- "cp url X" will copy the URL of link X (suggested by Eoin Carney)
|
||||||
- HTML renderering of <pre> has been improved
|
- HTML renderering of <pre> has been improved
|
||||||
- "fold" has been removed as it doesn’t work well anyway with our width.
|
- "fold" has been removed as it doesn’t work well anyway with our width.
|
||||||
- Fixed crash when chafa is not installed (Thanks Xavier Hinault for the report)
|
- Fixed crash when chafa is not installed (Thanks Xavier Hinault for the report)
|
||||||
|
|
10
offpunk.py
10
offpunk.py
|
@ -2589,15 +2589,21 @@ class GeminiClient(cmd.Cmd):
|
||||||
else:
|
else:
|
||||||
print("Already online. Try offline.")
|
print("Already online. Try offline.")
|
||||||
|
|
||||||
def do_copy(self, *args):
|
def do_copy(self, arg):
|
||||||
"""Copy the content of the last visited page as gemtext in the clipboard.
|
"""Copy the content of the last visited page as gemtext in the clipboard.
|
||||||
Use with "url" as argument to only copy the adress.
|
Use with "url" as argument to only copy the adress.
|
||||||
Use with "raw" to copy ANSI content as seen in your terminal (not gemtext).
|
Use with "raw" to copy ANSI content as seen in your terminal (not gemtext).
|
||||||
Use with "cache" to copy the path of the cached content."""
|
Use with "cache" to copy the path of the cached content."""
|
||||||
if self.gi:
|
if self.gi:
|
||||||
if _HAS_XSEL:
|
if _HAS_XSEL:
|
||||||
|
args = arg.split()
|
||||||
if args and args[0] == "url":
|
if args and args[0] == "url":
|
||||||
subprocess.call(("echo %s |xsel -b -i" % self.gi.url), shell=True)
|
if len(args) > 1 and args[1].isdecimal():
|
||||||
|
gi = self.index[int(args[1])-1]
|
||||||
|
url = gi.url
|
||||||
|
else:
|
||||||
|
url = self.gi.url
|
||||||
|
subprocess.call(("echo %s |xsel -b -i" % url), shell=True)
|
||||||
elif args and args[0] == "raw":
|
elif args and args[0] == "raw":
|
||||||
subprocess.call(("cat %s |xsel -b -i" % self.gi.get_temp_filename()), shell=True)
|
subprocess.call(("cat %s |xsel -b -i" % self.gi.get_temp_filename()), shell=True)
|
||||||
elif args and args[0] == "cache":
|
elif args and args[0] == "cache":
|
||||||
|
|
Loading…
Reference in New Issue