forked from extern/nushell
make the charpage optional for std clip
(#10053)
related to
-
https://discord.com/channels/601130461678272522/615253963645911060/1142060647358668841
# Description
in order to make the charpage for Windows as general as possible, `chcp`
will only run on Windows when `--charpage` is given an integer.
while i was at it, i fixed the system messages given to
`check-clipboard` because some of the were incorrect => see the second
commit 6865ec9a5
# User-Facing Changes
this is a breaking change as users relying on the fact that `std clip`
changed the page to `65001` by itself is not true anymore => they will
have to add `--charpage 65001`.
# Tests + Formatting
# After Submitting
This commit is contained in:
parent
98c7ab96b6
commit
9f4510f2e1
@ -142,6 +142,7 @@ export def clip [
|
||||
--no-notify: bool # do not throw a notification (only on linux)
|
||||
--no-strip: bool # do not strip ANSI escape sequences from a string
|
||||
--expand (-e): bool # auto-expand the data given as input
|
||||
--codepage (-c): int # the id of the codepage to use (only on Windows), see https://en.wikipedia.org/wiki/Windows_code_page, e.g. 65001 is for UTF-8
|
||||
] {
|
||||
let input = (
|
||||
$in
|
||||
@ -161,16 +162,18 @@ export def clip [
|
||||
}
|
||||
},
|
||||
"windows" => {
|
||||
chcp 65001 # see https://discord.com/channels/601130461678272522/601130461678272524/1085535756237426778
|
||||
check-clipboard clip.exe --system $"('xorg' | pretty-command) on linux"
|
||||
if $codepage != null {
|
||||
chcp $codepage
|
||||
}
|
||||
check-clipboard clip.exe --system "Windows"
|
||||
$input | clip.exe
|
||||
},
|
||||
"macos" => {
|
||||
check-clipboard pbcopy --system macOS
|
||||
check-clipboard pbcopy --system "MacOS"
|
||||
$input | pbcopy
|
||||
},
|
||||
"android" => {
|
||||
check-clipboard termux-clipboard-set --system Termux
|
||||
check-clipboard termux-clipboard-set --system "Termux"
|
||||
$input | termux-clipboard-set
|
||||
},
|
||||
_ => {
|
||||
@ -290,4 +293,4 @@ Startup Time: ($nu.startup-time)
|
||||
# Return the current working directory
|
||||
export def pwd [] {
|
||||
$env.PWD
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user