Pass all unknown arguments to the launch command

Fixes: https://gitlab.freedesktop.org/upower/power-profiles-daemon/-/issues/144
This commit is contained in:
Mario Limonciello 2024-03-26 15:08:15 -05:00
parent cb77e0ad34
commit 87fea13806
2 changed files with 13 additions and 1 deletions

View file

@ -205,10 +205,12 @@ def get_parser():
def main():
args = get_parser().parse_args()
args, unknown = get_parser().parse_known_args()
# default behavior is to run list if no command is given
if not args.command:
args.func = _list
if args.command == "launch":
args.arguments += unknown
args.func(args)

View file

@ -1682,6 +1682,16 @@ class Tests(dbusmock.DBusTestCase):
self.stop_daemon()
def test_unknown_args(self):
self.create_platform_profile()
self.start_daemon()
self.assert_eventually(lambda: self.get_dbus_property("ActiveProfile"))
builddir = os.getenv("top_builddir", ".")
tool_path = os.path.join(builddir, "src", "powerprofilesctl")
subprocess.check_call([tool_path, "launch", "true", "--foo"])
def test_vanishing_hold(self):
self.create_platform_profile()
self.start_daemon()