broot icon indicating copy to clipboard operation
broot copied to clipboard

invalid command or invalid broot behavior ?

Open evanescente-ondine opened this issue 3 years ago • 7 comments

the function { invocation: names key: ctrl-n external: "wl-copy (basename -a {file})" leave_broot: false apply_to: any }

results in :

wl-copy: invalid option -- 'a' Usage: wl-copy [options] text to copy wl-copy [options] < file-to-copy Copy content to the Wayland clipboard.

Even though the same command in the terminal works fine... What did I do wrong ?

evanescente-ondine avatar Feb 10 '22 16:02 evanescente-ondine

I don't know what's wl-copy but you should probably use the array form. See https://dystroy.org/broot/conf_verbs/

Canop avatar Feb 10 '22 16:02 Canop

wl-copy is part of wl-clipboard, to copy/paste stuff in wayland using commands. external: ["wl-copy" "(basename -a {file})"] substitutes {file} but wl-copy only copies the resultant string starting with "(basename" ending with ')' I use fish shell, which processes things in parentheses as commands whose results must be inserted in there. Some incompatibility perhaps ? Also, eventhough the "-a" parameters of basename allows for several files to be processed (I tried), here, even within the stagging area, only the first name is substituted

evanescente-ondine avatar Feb 10 '22 19:02 evanescente-ondine

wl-copy (basename -a {file}) must be a fish shell feature the command is not interpreted by the shell in broot (I guess ?)

Stargateur avatar Feb 11 '22 00:02 Stargateur

basename is part of coreutils, wl-copy is a normal program. Only () is FISH-specific and replaces $( ) in BASH. Considering the author was kind enough to provide the FISH function for "br", I doubt this is the issue... Could someone try and do execute this { invocation: names key: ctrl-n external: "wl-copy (basename -a {file})" [with perhaps: external: ["wl-copy" "(basename -a {file})"] instead ? ] leave_broot: false apply_to: any }

Any wayland desktop would do. Just to be sure it's not only on my side.

evanescente-ondine avatar Feb 11 '22 01:02 evanescente-ondine

@Stargateur might be right, here, it that this command probably needs to be executed in a shell, either by calling something like external ["sh" "-s" "wl-copy (basename -a {file})"] or by adding a specific mode for that in broot command executions.

Canop avatar Feb 11 '22 06:02 Canop

Any variant of external: "fish -c wl-copy (basename -a {file})" with array form or -C instead of both, with or without & and ";exit" or both, results in a black screen with a blinking prompt, but no shell. external: "bash -r -c wl-copy $(basename -a {file})" does the same.

evanescente-ondine avatar Feb 11 '22 13:02 evanescente-ondine

OK, I'll have to have a look when I find the time.

Canop avatar Feb 11 '22 14:02 Canop