-
-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for osc52 system command
support copying text on supported terminals
- Loading branch information
1 parent
196940f
commit d1fa5a5
Showing
7 changed files
with
71 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,4 @@ | |
*.out | ||
|
||
# Dependency directories (remove the comment below to include it) | ||
# vendor/ | ||
# vendor/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package termenv | ||
|
||
import ( | ||
"github.com/aymanbagabas/go-osc52" | ||
) | ||
|
||
// Copy copies text to clipboard using OSC 52 escape sequence. | ||
func (o Output) Copy(str string) { | ||
out := osc52.NewOutput(o.tty, o.environ.Environ()) | ||
out.Copy(str) | ||
} | ||
|
||
// Copy copies text to clipboard using OSC 52 escape sequence. | ||
func Copy(str string) { | ||
output.Copy(str) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package termenv | ||
|
||
import ( | ||
"fmt" | ||
) | ||
|
||
// Hyperlink creates a hyperlink using OSC8. | ||
func Hyperlink(link, name string) string { | ||
return output.Hyperlink(link, name) | ||
} | ||
|
||
// Hyperlink creates a hyperlink using OSC8. | ||
func (o *Output) Hyperlink(link, name string) string { | ||
return fmt.Sprintf("\x1b]8;;%s\x1b\\%s\x1b]8;;\x1b\\", link, name) | ||
} |