ubuntu / zsys

ZSys daemon and client for zfs systems
GNU General Public License v3.0
301 stars 43 forks source link

zsys save -u fails when user is not provided #238

Closed introt closed 1 year ago

introt commented 1 year ago

Describe the bug See title.

To Reproduce Steps to reproduce the behavior:

  1. Execute zsys save STATENAME -u
  2. See error: ERROR flag needs an argument: 'u' in -u

Expected behavior According to zsys save --help, the command should save state for the current user if a username isn't provided

  -u, --user string          Save the state for a given user or current user if empty

Installed versions:

didrocks commented 1 year ago

Thanks for filing your feedback about zsys.

´-u´ is a flag to provide an explicit user to save for. Without the flag (and so, without defining -u, the current user will saved). Indeed, the working of the flag could be improved. This is an easy patch for anyone interested :)

introt commented 1 year ago

My bad, it is indeed working as intended - though the intention could be made a bit clearer :)

Here's two excerpts from zsysctl-save, emphasis mine:

zsysctl-save - Saves the current state of the machine. By default it saves only the user state. state_id is generated if not provided.

   -s, --system[=false]
      Save complete system state (users and system)

  -u, --user=""
      Save the state for a given user or current user if empty

zsysctl state save --help does include the emphasized part, but zsysctl save --help simply states the following:

Alias of zsysctl state save

It's also to be noted that [=false] and ="" are omitted from the --help, thus the "if empty" part is easy to read as "if note given"; indeed, passing the empty string (as in -u '') does work.

Indeed, the working of the flag could be improved. This is an easy patch for anyone interested :)

Might have to give go a go :D In the meantime, does -s false equal to -u ''?

didrocks commented 1 year ago

Fixed by #239.