Skip to content

Fix commandline options parsing

Avinash Sonawane requested to merge rootkea/xfce4-terminal:small-fixes into master

Fixes #105 (closed)

This MR accomplishes the following:

  1. $ xfce4-terminal --titlegarbage foo shouldn't be accepted as valid option. On current master it does.
  2. As per POSIX -- should act as an option delimiter
  3. $ xfce4-terminal -T=foo shouldn't be accepted as valid option.
  4. Allow grouping one more options with no args followed by at most one option with arg #105 (closed)
  5. POSIX says "a conforming implementation shall also permit applications to specify the option and option-argument in the same argument string without intervening characters." e.g. $ xfce4-terminal -els
  6. For $ xfce4-terminal -Hz print "Unknown option "-z"" instead of "Unknown option "-Hz""
  7. Optimizes --help/-h, --version/-V, --color-table and --preferences options handling.

Caveat (This is existing current behavior on master branch):

  1. From $ man xfce4-terminal
    -x, --execute Execute the remainder of the command line inside the terminal

The "remainder of the command line" starts from the next arg of x/--execute. So,
$ xfce4-terminal -x ls valid
$ xfce4-terminal --execute ls valid
$ xfce4-terminal -xls invalid
$ xfce4-terminal --execute=ls invalid

This MR preserves this existing behavior.

Edited by Avinash Sonawane

Merge request reports