Open Drugoy opened 2 years ago
Thanks for the comment! I fully agree with the reason why you are confused. Because there is not enough help message (or document) for this.
But, basically, the options
will have sub-priority when used with other commands by default.
So, it is likely to be an improvement rather than a bug.
I think the order should stay important here.
attach
is not an option
and is not a subcommand of options
.
options
is a subcommand of attach
.
I agree, we could improve the error message here.
The help messages are quite clear already (IMHO):
$ zellij attach --help
:
zellij-attach
Attach to session
USAGE:
zellij attach [OPTIONS] [SESSION_NAME] [SUBCOMMAND]
ARGS:
<SESSION_NAME> Name of the session to attach to
OPTIONS:
-c, --create Create a session if one does not exist
-h, --help Print help information
--index <INDEX> Number of the session index in the active sessions ordered creation date
SUBCOMMANDS:
help Print this message or the help of the given subcommand(s)
options Change the behaviour of zellij
$ zellij options --help
:
zellij-options
Change the behaviour of zellij
USAGE:
zellij options [OPTIONS]
OPTIONS:
--copy-clipboard <COPY_CLIPBOARD>
OSC52 destination clipboard [possible values: system, primary]
--copy-command <COPY_COMMAND>
Switch to using a user supplied command for clipboard instead of OSC52
--default-mode <DEFAULT_MODE>
Set the default mode
--default-shell <DEFAULT_SHELL>
Set the default shell
--disable-mouse-mode
Disable handling of mouse events
-h, --help
Print help information
--layout-dir <LAYOUT_DIR>
Set the layout_dir, defaults to subdirectory of config dir
--mirror-session <MIRROR_SESSION>
Mirror session when multiple users are connected (true or false)
--mouse-mode <MOUSE_MODE>
Set the handling of mouse events (true or false) Can be temporarily bypassed by the
[SHIFT] key
--no-pane-frames
Disable display of pane frames
--on-force-close <ON_FORCE_CLOSE>
Set behaviour on force close (quit or detach)
--pane-frames <PANE_FRAMES>
Set display of the pane frames (true or false)
--scroll-buffer-size <SCROLL_BUFFER_SIZE>
--simplified-ui <SIMPLIFIED_UI>
Allow plugins to use a more simplified layout that is compatible with more fonts (true
or false)
--theme <THEME>
Set the default theme
More confusion is brought by using the same words:
zellij 0.29.1
USAGE:
zellij [OPTIONS] [SUBCOMMAND]
OPTIONS:
-c, --config <CONFIG> Change where zellij looks for the configuration file [env:
ZELLIJ_CONFIG_FILE=]
--config-dir <CONFIG_DIR> Change where zellij looks for the configuration directory
[env: ZELLIJ_CONFIG_DIR=]
-d, --debug
--data-dir <DATA_DIR> Change where zellij looks for layouts and plugins
-h, --help Print help information
-l, --layout <LAYOUT> Name of a layout file in the layout directory
--layout-path <LAYOUT_PATH> Path to a layout yaml file
--max-panes <MAX_PANES> Maximum panes on screen, caution: opening more panes will
close old ones
-s, --session <SESSION> Specify name of a new session
-V, --version Print version information
SUBCOMMANDS:
attach Attach to session
help Print this message or the help of the given subcommand(s)
kill-all-sessions Kill all sessions
kill-session Kill the specific session
list-sessions List active sessions
options Change the behaviour of zellij
setup Setup zellij and check its configuration
so the general usage is zellij [OPTIONS] [SUBCOMMAND]
, yet there's a subcommand named options
...
So sometimes options is not options, but a subcommand (but hey, you may specify some options when using subcommand options
!)
No, options
is always options
and OPTIONS
is always OPTIONS
.
So OPTIONS
is OPTIONS
, but options
is a SUBCOMMAND
.
Now try to read that sentence out loud to someone else and ask them if that made sense to them.
:face_with_spiral_eyes:
So
OPTIONS
isOPTIONS
, butoptions
is aSUBCOMMAND
Exactly, and to make it a little bit clearer:
OPTIONS
is OPTIONS
and SUBCOMMAND
is SUBCOMMAND
.
You can think of OPTIONS
as flags:
For example --help
is a flag, so it belongs to OPTIONS
and is not a SUBCOMMAND
.
For example attach
is a subcommand, so it belongs to SUBCOMMAND
and does not belong to OPTIONS
, because it is not a flag.
For example options
is a subcommand, so it belongs to SUBCOMMAND
and does not belong to OPTIONS
, because it is not a flag.
You didn't get me: the currently chosen wording is confusing, it needs to be changed. Even though I had already understood which is what and I am currently not confused about the situation anymore, the wording still remains confusing and still needs to be changed. As a proof of my argument I've created a good test case about reading the sentence out loud to someone else and asking for feedback. :)
Due to how clap
works, as far as I know, the term OPTIONS
cannot be changed. But the subcommand options
could. I agree that there should be some distinction made because as it is, there's two very different definitions of the word "options" being used in the same context. You have command/subcommand options (e.g. zellij --debug
, zellij attach --create
), but then you also have option options (e.g. zellij option --no-pane-frames
).
Changing the subcommand options
to behaviors
could be a solution?
Honestly, I'd change the options
subcommand to config
(because that's what it is) then change --config
to --config-file
and --config-dir
to --config-dir-location
. But considering there's also some confusion at https://github.com/zellij-org/zellij/issues/1412, maybe we need to do this in one fell sweep and rethink all the command line arguments to avoid further confusion.
however if I change the order of sub-commands to
$ zellij attach options --copy-command="xsel -i -b"
or even$ zellij attach my-session-name options --copy-command="xsel -i -b"
it works fine.zellij 0.29.1