Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce a standalone CLI program #914

Open
1 task done
sxyazi opened this issue Apr 15, 2024 · 2 comments
Open
1 task done

Introduce a standalone CLI program #914

sxyazi opened this issue Apr 15, 2024 · 2 comments
Labels
feature New feature request

Comments

@sxyazi
Copy link
Owner

sxyazi commented Apr 15, 2024

Please describe the problem you're trying to solve

For a long time, Yazi has been designed as a TUI application. But as Yazi continues to evolve, new needs arise, and these needs can be more efficiently met as a CLI program.

When Yazi starts, it needs to read all configuration files, check and merge these configurations, and detect the operating system and terminal type for correct image rendering. These are time-consuming operations, especially detecting the terminal type, which requires sending CSI sequences to the terminal and waiting for a response.

This requires Yazi to have the ability to read from stdin. But this is not suitable when integrating externally, such as calling Yazi in a shell script to perform the following tasks:

  • ya send: Ability to communicate with DDS to address Ability to change yazi CWD from external process #891. After changing the shell's current working directory, send a message to Yazi to notify the ongoing Yazi instance to synchronize the cwd.
  • ya cp: A faster alternative to cp with the powerful async task scheduling system, providing a progress bar and more beautiful. This is part of future plans.
  • ya mv: A faster alternative to mv with the powerful async task scheduling system, providing a progress bar and more beautiful. This is part of future plans.
  • ya ls: A faster and more beautiful alternative to ls. This is part of future plans.
  • ya colors: Address Produce LS_COLORS output when invoked with special flag #852, output Yazi themes as LS_COLORS for a more readable way to use these colors in the shell through configuring the Yazi theme. It still needs to read the configuration file, but it can be minimized and lazily loaded only when this command is called, rather than at program startup, and only the theme configuration is read. Note that I am still considering whether to implement it; it may ultimately not become a reality.
  • ya plugin / ya theme: Providing plugins, theme management functionality, such as installation, updating, uninstalling, etc., is also a feature I am still considering.

The new CLI program will use ya as its name because it is short enough and will be more convenient when executing commands like ya cp or ya mv.

The only issue might be potential name conflicts with shell wrappers, but I don't think this is a big problem - I renamed the shell wrapper to yy last month, and it does not interfere with existing users since shell functions should always take precedence over CLI programs.

For new users who want to use the new CLI, I will note in the documentation that it may conflict with the name of the shell wrapper they set before.

Would you be willing to contribute this feature?

  • Yes, I'll give it a shot

Describe the solution you'd like

.

Additional context

No response

@raffaem
Copy link

raffaem commented May 8, 2024

  • ya cp: A faster alternative to cp with the powerful async task scheduling system, providing a progress bar and more beautiful. This is part of future plans.

  • ya mv: A faster alternative to mv with the powerful async task scheduling system, providing a progress bar and more beautiful. This is part of future plans.

What would be the difference with advcpmv?

eljamm added a commit to eljamm/home-manager that referenced this issue Jun 23, 2024
The program shell wrappers have been renamed from `ya` to `yy` since the
introduction of the new CLI tool, which took the name of `ya`.

For more information, see sxyazi/yazi#914
eljamm added a commit to eljamm/home-manager that referenced this issue Jun 23, 2024
The program shell wrappers have been renamed from `ya` to `yy` since the
introduction of the new CLI tool, which took the name of `ya`.

For more information, see sxyazi/yazi#914
eljamm added a commit to eljamm/home-manager that referenced this issue Jun 23, 2024
The program shell wrappers have been renamed from `ya` to `yy` since the
introduction of the new CLI tool, which took the name of `ya`.

For more information, see sxyazi/yazi#914
eljamm added a commit to eljamm/home-manager that referenced this issue Jun 23, 2024
The program shell wrappers have been renamed from `ya` to `yy` since the
introduction of the new CLI tool, which took the name of `ya`.

For more information, see sxyazi/yazi#914
eljamm added a commit to eljamm/home-manager that referenced this issue Jun 24, 2024
The program shell wrappers have been renamed from `ya` to `yy` since the
introduction of the new CLI tool, which took the name of `ya`.

For more information, see sxyazi/yazi#914

Co-authored-by: XYenon <[email protected]>
@eljamm
Copy link

eljamm commented Jun 24, 2024

Sorry for all the reference spam 😓

I learned that it might not always be appropriate to link issues in commits, especially if GitHub's gonna reference it again after every rebase.

eljamm added a commit to eljamm/nixpkgs that referenced this issue Jul 3, 2024
In addition to the main program, there is a new CLI tool, now:
sxyazi/yazi#914
Pandapip1 pushed a commit to Pandapip1/nixpkgs that referenced this issue Jul 4, 2024
In addition to the main program, there is a new CLI tool, now:
sxyazi/yazi#914
mikavilpas added a commit to mikavilpas/yazi.nvim that referenced this issue Jul 7, 2024
This change is optional, and by default is not enabled for users.

To opt in, you need to do the following:
- install the latest `yazi` from source
- install the latest `ya` from source. `ya` is the standalone command
  line tool for yazi. You can read
  <sxyazi/yazi#914> for more information.
- set the new config option `use_ya_for_events_reading = true` (it's
  `false` by default for now)
- run `:checkhealth yazi` to verify that `ya` is found and that the
  healthcheck passes

Bulk renaming in yazi is done by
- selecting multiple files in yazi
- pressing `r` to rename the files. This will open `$EDITOR`, typically
  Neovim, inside yazi.
- The nested Neovim will display the selected file names, one per line.
  The user can then edit the names as needed.
- save and quit the nested Neovim instance. This will rename the files
  in yazi.

<https://yazi-rs.github.io/docs/configuration/keymap/#manager.rename>

---

Technical details for developers:

- in the future, once the next release of yazi is out, yazi.nvim may
  automatically use `ya` for reading events. This would then be the
  default behavior. `ya` may enable more advanced features in the
  future.
- `yazi` is now built from source in continuous integration
- the integration testing system, although perhaps innovative, is still
  taking shape. I believe in time it will stabilize, but I don't want to
  cement the design too much until the best structure becomes evident in
  time.

Closes #135
mikavilpas added a commit to mikavilpas/yazi.nvim that referenced this issue Jul 7, 2024
This change is optional, and by default is not enabled for users.

To opt in, you need to do the following:
- install the latest `yazi` from source
- install the latest `ya` from source. `ya` is the standalone command
  line tool for yazi. You can read
  <sxyazi/yazi#914> for more information.
- set the new config option `use_ya_for_events_reading = true` (it's
  `false` by default for now)
- run `:checkhealth yazi` to verify that `ya` is found and that the
  healthcheck passes

Bulk renaming in yazi is done by
- selecting multiple files in yazi
- pressing `r` to rename the files. This will open `$EDITOR`, typically
  Neovim, inside yazi.
- The nested Neovim will display the selected file names, one per line.
  The user can then edit the names as needed.
- save and quit the nested Neovim instance. This will rename the files
  in yazi.

<https://yazi-rs.github.io/docs/configuration/keymap/#manager.rename>

---

Technical details for developers:

- in the future, once the next release of yazi is out, yazi.nvim may
  automatically use `ya` for reading events. This would then be the
  default behavior. `ya` may enable more advanced features in the
  future.
- `yazi` is now built from source in continuous integration
- the integration testing system, although perhaps innovative, is still
  taking shape. I believe in time it will stabilize, but I don't want to
  cement the design too much until the best structure becomes evident in
  time.

Closes #135
mikavilpas added a commit to mikavilpas/yazi.nvim that referenced this issue Jul 10, 2024
* feat: support bulk renaming files in nightly yazi (opt-in)

This change is optional, and by default is not enabled for users.

To opt in, you need to do the following:
- install the latest `yazi` from source
- install the latest `ya` from source. `ya` is the standalone command
  line tool for yazi. You can read
  <sxyazi/yazi#914> for more information.
- set the new config option `use_ya_for_events_reading = true` (it's
  `false` by default for now)
- run `:checkhealth yazi` to verify that `ya` is found and that the
  healthcheck passes

Bulk renaming in yazi is done by
- selecting multiple files in yazi
- pressing `r` to rename the files. This will open `$EDITOR`, typically
  Neovim, inside yazi.
- The nested Neovim will display the selected file names, one per line.
  The user can then edit the names as needed.
- save and quit the nested Neovim instance. This will rename the files
  in yazi.

<https://yazi-rs.github.io/docs/configuration/keymap/#manager.rename>

---

Technical details for developers:

- in the future, once the next release of yazi is out, yazi.nvim may
  automatically use `ya` for reading events. This would then be the
  default behavior. `ya` may enable more advanced features in the
  future.
- `yazi` is now built from source in continuous integration
- the integration testing system, although perhaps innovative, is still
  taking shape. I believe in time it will stabilize, but I don't want to
  cement the design too much until the best structure becomes evident in
  time.

Closes #135, closes #130

* chore: always open cypress in e2e mode by default

* fixup! feat: support bulk renaming files in nightly yazi (opt-in)

* fixup! feat: support bulk renaming files in nightly yazi (opt-in)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature request
Projects
None yet
Development

No branches or pull requests

3 participants