Canop / broot

A new way to see and navigate directory trees : https://dystroy.org/broot
MIT License
10.64k stars 234 forks source link

Add a --verb-output launch argument #825

Closed Canop closed 7 months ago

Canop commented 8 months ago

Similar to the existing --outcmd, but the file whose path is given as argument would contain what the verb decides to write.

The verb could for example be :write {file}:{line} or :write {path}.

Each time there's a write after the first one, a \n would be inserted. There could be several lines, for example when a verb doesn't quit broot, or when the verb is called in the staging area.

Such a file would mainly be the basis for a rewritten br shell function, which would solve some escaping problems.

Related: https://github.com/Canop/broot/issues/824

AndydeCleyre commented 8 months ago

Thanks! To be clear, in your example, :write is a new internal that appends to the file specified by --verb-output?

Like a manual logger?

Canop commented 8 months ago

Thanks! To be clear, in your example, :write is a new internal that appends to the file specified by --verb-output?

Yes.

AndydeCleyre commented 8 months ago

FWIW, I happen to be using a verb with that particular name:

  {
    invocation: write {subpath}
    external: $EDITOR {directory}/{subpath}
    leave_broot: false
  }

And I'm inclined to think of the upcoming internal as "append line"

Canop commented 8 months ago

For a verb similar to yours, which is dedicated to creating new files, I use "create" with shortcut "cr".

append_line wouldn't really convey the intent, which is most often to write only one path and exit.

Canop commented 7 months ago

@AndydeCleyre Did you see/test the PR ?

AndydeCleyre commented 7 months ago

No! Thanks for the work and the ping!

I'll test today or tonight.