Code Monkey home page Code Monkey logo

Comments (9)

topongo avatar topongo commented on June 12, 2024

I didn't know about this feature, and because I'm very interested in it, I can see if I find some clues

from joshuto.

DLFW avatar DLFW commented on June 12, 2024

Hi!
Try this:

joshuto --file-chooser --output-file ~/my-temp-file

The selected file is written to the given temp-file.

It's for example used in this NeoVim plugin, which add Joshuto as a way to open a file.

from joshuto.

Rolv-Apneseth avatar Rolv-Apneseth commented on June 12, 2024

Ah yes that seems to work thanks. It does still exit with an error though but I guess as long as it works it's fine.

And that's funny, thanks for sharing that plugin, that's exactly the kind of thing I was looking to do

from joshuto.

DLFW avatar DLFW commented on June 12, 2024

Hmmm, not exactly an error, I guess: https://github.com/kamiyaa/joshuto/blob/6cabeb9c8308e5debc9eda3ef8dadda268545156/src/commands/quit.rs#L22C20-L22C20

If this is really not documented somewhere, I agree, it should be...

from joshuto.

Rolv-Apneseth avatar Rolv-Apneseth commented on June 12, 2024

I don't know much about exit codes to be honest, but shouldn't it be 0 if there was no problem with the operation?

from joshuto.

kamiyaa avatar kamiyaa commented on June 12, 2024

Hmmm, not exactly an error, I guess: https://github.com/kamiyaa/joshuto/blob/6cabeb9c8308e5debc9eda3ef8dadda268545156/src/commands/quit.rs#L22C20-L22C20

If this is really not documented somewhere, I agree, it should be...

Yeah, I should document it somewhere

from joshuto.

kamiyaa avatar kamiyaa commented on June 12, 2024

I don't know much about exit codes to be honest, but shouldn't it be 0 if there was no problem with the operation?

Yeah, usually 0 means success. Non-zero means an error, but can also be used to communicate other things

from joshuto.

dgmcdona avatar dgmcdona commented on June 12, 2024

Should this be println! and not eprintln!? Personally, I'd rather have this sent to stdout than stderr. Also, for some reason the file list doesn't even output to stderr as-is, but when I recompile with println! instead, the files display to stdout as expected.

eprintln!("{}", file.display());

from joshuto.

kamiyaa avatar kamiyaa commented on June 12, 2024

Should this be println! and not eprintln!? Personally, I'd rather have this sent to stdout than stderr. Also, for some reason the file list doesn't even output to stderr as-is, but when I recompile with println! instead, the files display to stdout as expected.

eprintln!("{}", file.display());

ratatui/termion (not sure which one) doesn't allow for joshuto's output to be piped.

This makes it a bit tricky to get joshuto to work with shell scripts.
Because you can't just do file_path=$(joshuto --file-chooser) because the output is piped.

So the only other option is to pipe it to a file.

joshuto --file-chooser > some_file.txt

But this won't work either because joshuto outputs to stdout, which gets piped to the file.

So the only sensible solution is to have

joshuto --file-chooser 2> some_file.txt

Hope this clears things up!

from joshuto.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.