Skip to content
New issue

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

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

Already on GitHub? # to your account

Can not parse option without dummy arg in plugin API #2429

Closed
3 tasks done
bulletmark opened this issue Mar 2, 2025 · 5 comments · Fixed by #2431
Closed
3 tasks done

Can not parse option without dummy arg in plugin API #2429

bulletmark opened this issue Mar 2, 2025 · 5 comments · Fixed by #2431
Labels
bug Something isn't working

Comments

@bulletmark
Copy link

bulletmark commented Mar 2, 2025

What system are you running Yazi on?

Linux Wayland

What terminal are you running Yazi in?

kitty 0.39.1

yazi --debug output

$ yazi --debug

Yazi
    Version: 25.3.2 (46125eda 2025-03-02)
    Debug  : false
    Triple : x86_64-unknown-linux-gnu (linux-x86_64)
    Rustc  : 1.85.0 (4d91de4e 2025-02-17)

Ya
    Version: 25.3.2 (46125eda 2025-03-02)

Emulator
    TERM                : Some("xterm-kitty")
    TERM_PROGRAM        : None
    TERM_PROGRAM_VERSION: None
    Brand.from_env      : Some(Kitty)
    Emulator.detect     : Emulator { kind: Left(Kitty), light: false, cell_size: Some((10, 22)) }

Adapter
    Adapter.matches: Kgp

Desktop
    XDG_SESSION_TYPE           : Some("wayland")
    WAYLAND_DISPLAY            : Some("wayland-0")
    DISPLAY                    : Some(":0")
    SWAYSOCK                   : None
    HYPRLAND_INSTANCE_SIGNATURE: None
    WAYFIRE_SOCKET             : None

SSH
    shared.in_ssh_connection: false

WSL
    WSL: false

Variables
    SHELL           : Some("/bin/bash")
    EDITOR          : Some("nvim")
    VISUAL          : Some("nvim")
    YAZI_FILE_ONE   : None
    YAZI_CONFIG_HOME: None
    YAZI_ZOXIDE_OPTS: None
    FZF_DEFAULT_OPTS: None

Text Opener
    default     : Some(Opener { run: "${EDITOR:-vi} \"$@\"", block: true, orphan: false, desc: "$EDITOR", for_: None, spread: true })
    block-create: Some(Opener { run: "${EDITOR:-vi} \"$@\"", block: true, orphan: false, desc: "$EDITOR", for_: None, spread: true })
    block-rename: Some(Opener { run: "${EDITOR:-vi} \"$@\"", block: true, orphan: false, desc: "$EDITOR", for_: None, spread: true })

Multiplexers
    TMUX               : false
    tmux version       : tmux 3.5a
    tmux build flags   : enable-sixel=Unknown
    ZELLIJ_SESSION_NAME: None
    Zellij version     : No such file or directory (os error 2)

Dependencies
    file          : 5.46
    ueberzugpp    : No such file or directory (os error 2)
    ffmpeg/ffprobe: 7.1 / 7.1
    pdftoppm      : 25.02.0
    magick        : 7.1.1-44
    fzf           : 0.60.2
    fd/fdfind     : 10.2.0 / No such file or directory (os error 2)
    rg            : 14.1.1
    chafa         : No such file or directory (os error 2)
    zoxide        : 0.9.7
    7zz/7z        : No such file or directory (os error 2) / 24.09
    jq            : 1.7.1

Clipboard
    wl-copy/paste: 2.2.1 / 2.2.1
    xclip        : No such file or directory (os error 2)
    xsel         : No such file or directory (os error 2)


See https://yazi-rs.github.io/docs/plugins/overview#debugging on how to enable logging or debug runtime errors.)

Describe the bug

I recently created a plugin. It seems a bug that I had to add a dummy option as seen in that link. I.e. I expect I should be able to define the run command as plugin cdhist -- --fuzzy=fzf (or even just plugin cdhist --fuzzy=fzf) but I have to add a dummy _ as in plugin cdhist -- _ --fuzzy=fzf because without it jobs.args does not see the option at all.

I am absolutely a beginner to both yazi and lua so this may be my misunderstanding.

Minimal reproducer

N/A

Anything else?

No response

Checklist

  • I tried the latest nightly build, and the issue is still reproducible
  • I updated the debug information (yazi --debug) input box to the nightly that I tried
  • I can reproduce it after disabling all custom configs/plugins (mv ~/.config/yazi ~/.config/yazi-backup)
@bulletmark bulletmark added the bug Something isn't working label Mar 2, 2025
Copy link

github-actions bot commented Mar 2, 2025

Hey @bulletmark, I noticed that you did not correctly follow the issue template. Please ensure that:

  • The bug can still be reproduced on the newest nightly build.
  • The debug information (yazi --debug) is updated for the newest nightly.
  • The required fields in the checklist are checked.

Issues with needs info will be marked ready once edited with the proper content, or closed after 2 days of inactivity.

@bulletmark
Copy link
Author

Had to tick that last checklist item to get through GA even though I obviously need a plugin configured to test this bug.

@sxyazi
Copy link
Owner

sxyazi commented Mar 3, 2025

Please try #2431

@bulletmark
Copy link
Author

bulletmark commented Mar 3, 2025

It now works with or without that dummy arg but I wonder why you still require the --? It would look better if it was specified as a normal command with arguments/options. Can the plugin keyword be specified with it's own --options?

@sxyazi
Copy link
Owner

sxyazi commented Mar 3, 2025

Yes, plugin command can accept its own keyword arguments, but currently it doesn't have any keyword arguments.

It only takes two positional arguments: the plugin name and the plugin parameter, both of which are strings, see https://yazi-rs.github.io/docs/configuration/keymap/#manager.plugin.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants