Giter VIP home page Giter VIP logo

Comments (2)

kamiyaa avatar kamiyaa commented on June 11, 2024

However, all these solutions would require a breaking change in Joshuto: %s would change to something else, for example {{s}}. @kamiyaa: Would that be acceptable?

I'm cool with breaking changes if it means better UX and maintainability moving forward

from joshuto.

DLFW avatar DLFW commented on June 11, 2024

Hi,
I'm not much further on this, I just was too busy with other stuff.

However, I did some experimental implementations around Christmas and I came to the conclusion that a generic variable solution I had in mind won't work well with the current way Joshuto parses the command line input. To get such a solution straight, it would require a complete refactoring of Joshuto's command handling. The problem is mostly with escaping and quoting (I don't even remember all the details). I thought of introducing some CLI parser library (like clap) to parse the commands, but that would be too much effort for me at the moment. In any case, it would have some negative impact on performance. (don't know how much; maybe negligible).

I then re-thought to just introduce new variables the same way we already have %s, but this also has significant downsides (my personal notes here, in case somebody is really interested). Essentially, each command needs to implement each supported variable on its own and I think this could turn into quite some mess (code-wise) and a non-intuitive UI.

My latest idea now is to leave all commands just as they are but to introduce one new command, which I currently call stdout in my head. This command's job is to do something with the stdout of the last shell command.

This stdout command would take an action as first (and usually only) parameter. An action could for example be

  • cd: jump to the directory given as stdout
  • new-tabs: open a new tab for each line of stdout
  • jump-tab-name: activate the tab with the directory given as stdout
  • select-names: select the files which as listed by name in stdout
  • select-indexes: select the files with the indexes listed in stdout
  • ...

So, instead of using variables with the stdout content for the existing command, I would add one new command that takes some โ€œlast-stdoutโ€ specific action as parameter. It's less generic, but more explicit and does not negatively impact the code, the usability, or the performance.

Just dumping my thoughts here. If somebody has ideas or opinions, feel free.... ๐Ÿ˜‰
I hope I will finally find some time to work on this.

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.