From 79a536e4d023476692dca8a4854cccae1431a2f0 Mon Sep 17 00:00:00 2001 From: Karimullin Arthur Date: Sun, 28 Jul 2024 19:36:23 +0300 Subject: [PATCH 1/2] Added clickable link via [OSC standart](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda) and update it in README.md --- README.md | 1 + pystyle/__init__.py | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/README.md b/README.md index 8710098..69fd1db 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,7 @@ Stats: https://pepy.tech/project/pystyle - Make boxes ✔️ - Hide and Show Cursor ✔️ - System Functions ✔️ + - Clickable link ✔️
diff --git a/pystyle/__init__.py b/pystyle/__init__.py index 0e9f173..599cc1b 100644 --- a/pystyle/__init__.py +++ b/pystyle/__init__.py @@ -989,6 +989,24 @@ def Arrow(icon: str = 'a', size: int = 2, number: int = 2, direction = 'right') return _arrow +class Link: + """ + 1 functions: + create_link() | make clickable link + """ + + def create_link(uri: str, label=None) -> str: + if label is None: + label = uri + + parameters = "" + + # OSC 8 ; params ; URI ST OSC 8 ;; ST + escape_mask = "\033]8;{};{}\033\\{}\033]8;;\033\\" + + return escape_mask.format(parameters, uri, label) + + Box = Banner System.Init() From 7ac4bf7388917bf621e9655071a7ad5855557152 Mon Sep 17 00:00:00 2001 From: Karimullin Arthur Date: Sun, 28 Jul 2024 19:46:13 +0300 Subject: [PATCH 2/2] Edit func name from snake_case to PaschalCase to make it more compatible with the project. Sorry PEP8.. --- pystyle/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pystyle/__init__.py b/pystyle/__init__.py index 599cc1b..208caba 100644 --- a/pystyle/__init__.py +++ b/pystyle/__init__.py @@ -992,10 +992,10 @@ def Arrow(icon: str = 'a', size: int = 2, number: int = 2, direction = 'right') class Link: """ 1 functions: - create_link() | make clickable link + CreateLink() | make clickable link """ - def create_link(uri: str, label=None) -> str: + def CreateLink(uri: str, label=None) -> str: if label is None: label = uri