Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add parser for flatpak and flatpak update #104

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions resholve
Original file line number Diff line number Diff line change
Expand Up @@ -2395,6 +2395,68 @@ class ExternalCommandParsers(object):

return (generic,)

@staticmethod
def _flatpak():
"""
Based on Flatpak v1.14.4.
"""
generic = CommandParser("flatpak")

# flatpak --help
generic.add_argument(
"-h", "--help",
"--version",
"--default-arch",
"--supported-arches",
"--gl-drivers",
"--installations",
"--print-updated-env",
"--print-system-only",
"-v", "--verbose",
"--ostree-verbose",
action="store_true"
)
subparsers = generic.add_subparsers()
# flatpak update --help
update = subparsers.add_parser("update")
update.add_argument(
"-h", "--help",
"-u", "--user",
"--system",
action="store_true"
)
update.add_argument(
"--installation",
"--arch",
"--commit",
nargs=1
)
update.add_argument(
"--force-remove",
"--no-pull",
"--no-deploy",
"--no-related",
"--no-deps",
"--no-static-deltas",
"--runtime",
"--app",
"--appstream",
action="store_true"
)
update.add_argument("--subpath", nargs=1)
update.add_argument(
"-y", "--assumeyes",
"--noninteractive",
)
update.add_argument("--sideload-repo", nargs=1)
update.add_argument(
"-v", "--verbose",
"--ostree-verbose",
action="store_true"
)

return (generic,)


def generate_builtin_command_parser(cmdname):
cmdname = "_" + cmdname
Expand Down Expand Up @@ -3837,6 +3899,9 @@ class RecordCommandlike(object):
return True

def handle_external_generic(self, parsed, invocation):
if not hasattr(parsed, "commands"):
return True

# TODO: shimming shells in here may be a bigger crime than
# duplicating the logic in two functions would be?
shell = invocation.firstword in INVOKABLE_SHELLS
Expand Down