SUPERCILEX / fuc

Modern, performance focused unix commands
Apache License 2.0
340 stars 8 forks source link

Feature request: verbose output #23

Closed baodrate closed 1 year ago

baodrate commented 1 year ago

Most implementations of cp provide a -v which prints out directories as they are created. i.e.:

$ tree
.
└── foo
    ├── bar
    └── baz.txt

2 directories, 1 file

$ cpz -v foo backup/
foo -> backup/foo
foo/baz.txt -> backup/foo/baz.txt
foo/bar -> backup/foo/bar

This would be very useful for keeping track of what operations cpz actually performed. e.g. in case your shell glob pattern captured unintentional files)

Note: While most other cp implementations just output the paths directly to stdout, GNU cp also escapes each string so that non-printable characters and newlines are backslash-escaped (+the string is single-quoted). This gives the benefit that it's easy to copy some path from the terminal and call another command with it, even if it contains whitespace or special characters

SUPERCILEX commented 1 year ago

This one gets a no because it requires locking across the copy threads again (either in user space or in the kernel). If you want to see the result, you can use tree on the destination after the copy. Also, if you can read the verbose output then it means you're copying so few files that it won't really matter what tool you use. cpz is only really interesting once you've made it past a few thousand files. :)

baodrate commented 1 year ago

This one gets a no because it requires locking across the copy threads again

Yeah, totally fair. I realized the issue with cpz being multi-threaded after I wrote the issue

cpz is only really interesting once you've made it past a few thousand files

TBH, I'm mostly concerned with making sure my arguments are what I expected them to be. It's easy to lose your copies when you give cp/cpz a valid but unintentional path (like when I blast off the command with a few globs). But I suppose I can just solve that by just wrapping cpz like:

cpzv() {
  print -r ${(qq)@}
  cpz "$@"
}
SUPERCILEX commented 1 year ago

But I suppose I can just solve that by just wrapping cpz like

Yeah, I was going to say we could have cpz print the passed in args, but at that point why not just echo the args which is exactly what you did lol.