2

man xinput describes various options used with xinput. One option is this:

--list [--short || --long || --name-only || --id-only] [device] 

But I can run xinput --list or xinput list and both give the same output:

⎡ Virtual core pointer id=2 [master pointer (3)] ⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)] ⎜ ↳ PixArt USB Optical Mouse id=10 [slave pointer (2)] ⎜ ↳ PS/2 Mouse id=12 [slave pointer (2)] ⎜ ↳ AlpsPS/2 ALPS GlidePoint id=13 [slave pointer (2)] ⎣ Virtual core keyboard id=3 [master keyboard (2)] ↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)] ↳ Video Bus id=6 [slave keyboard (3)] ↳ Power Button id=7 [slave keyboard (3)] ↳ Sleep Button id=8 [slave keyboard (3)] ↳ Integrated_Webcam_1.3M id=9 [slave keyboard (3)] ↳ AT Translated Set 2 keyboard id=11 [slave keyboard (3)] ↳ Dell WMI hotkeys id=14 [slave keyboard (3)] 

Why is -- not needed before the list option?

(My OS is Lubuntu 13.10.)

1
  • Note that xinput --help (or xinput help) lists e.g. list without dashes. Commented Jun 13, 2020 at 7:29

2 Answers 2

5

Because that's how the developers wanted it.

-- and - are conventions for optional arguments.

no dashes is usually meant for operations.

In this case --list is both a operation (think sub command) and an optional argument.

See These Docs, but realize that the code writers can implement what they want. Truth is that while it is technically correct --list and list was probably implemented that way so that it was easier for more people to use.

1

The switching is completely up to the developer of the application, on how they'd like to implement it. But often times they're limited by other things out of their control, such as deciding to use a library/tool that will help them parse their command's command line argument.

For example, when developing a Bash script, 2 such tools/libraries that will facilitate this are getopt and getopts. This article does a pretty good job of showing some of the differences, titled: Bash getopt versus getopts.

Using these libraries will often times force, in a good way, the developer to implement their switching using either no dashes (i.e. list), a single dash, (i.e. (-l or -list)), or as a double dash, (--list).

Higher level languages such as Perl, Python, Ruby, C/C++ also have may of these types of libraries to choose from. This was only to explain why xinput can take either.

You must log in to answer this question.