-
Notifications
You must be signed in to change notification settings - Fork 573
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
cmd/snap: add ability to register "snap routine" commands #7589
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still like it. Thank you :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this approach. I think we should think about moving our other internal commands under this.
I've flagged @pedronis so he can give his input on it though.
b21b733
to
fc196f6
Compare
we have a lot of hidden commands ATM (even ignoring debug ones), but is not clear there is a simple path forward to move them to "internal ..." without problems of backward compatibility, they are used either by services or other packages. We would need to think that through, otherwise it seems we should simply continue as we did so far and add internal command without "internal" but just hidden. |
One thing to note is that putting things under
I can easily remove the |
@chipaca, potential commands to move would be: advise-snap, auto-import, handle-link, userd they are all used though by some piece of packaging under data/ so as I said the backward compatibility story is not very clean |
@jhenstridge WRT them being hidden, they should all be hidden, both the 'internal' command and each of its sub-commands. Probably needs a tweak on @pedronis I like it because it gives structure to something that right now is rather messy (internal commands are split between random toplevels and debug). Sadly indeed we need to keep a bunch of the toplevels for backwards compatibility, but having Alternatively we could say 'all future internal commands go under debug', and that would satisfy my need to contain the mess :-) |
@jhenstridge what/from where will portal-info be called? will it controlled from a piece of config we ship? or hard-coded into an upstream? |
The call will be hard coded into an upstream protect we don't control (xdg-desktop-portal). The upstream is friendly, but we won't have as much control over when updates are pushed to non Ubuntu distros. |
@jhenstridge thanks, @chipaca @jhenstridge it seems we need more a term/verb that means interfacing from/to other programs than internal, then at least: advise-snap, handle-link and portal-info could go under that |
It is not obvious to me why we'd want this: we don't currently hide individual
Maybe |
one issue here is that afaict, cc @chipaca, hidden commands are still auto-completed, I'm not sure whether that's intentional or a bug that is hard to fix? and whether hidden vs autocomplete should be orthogonal. with that in mind my current thinking would be for something like:
|
I can see how If hidden commands can't be removed from completion results, a name starting with "x" has the benefit of being less prominent and not sharing a prefix with existing user facing commands. |
Hidden commands are auto-completed, go-flags does not filter them out. We could probably do that filtering ourselves; go-flags does have an extension mechanism for this, even though it's rather crude. |
Having a different autocomplete flag that is considered true for not hidden, and default to false for hidden for but can be set to true if wanted would be ideal. This would give us slightly cleaner options to pursue this. I'm not sure we want to upstream a hidden == no autocomplete behavior without overrides. @chipaca how much work would it be just doing it on our side? |
@jhenstridge @chipaca #7690 makes the default for hidden commands to not complete anymore. This gives us more liberty to pick a verb/adjective/acronym that makes the most sense here. |
If completion is no longer an issue, I'm partial to |
My issue with So I'm looking more for something more generic that just means behavior on behalf of some other program (external or internal to snapd) vs user: now that completion is out of the way we can go for some actual word, so what I'm thinking right now is:
(even @chipaca, @jhenstridge what do you think? |
@pedronis I'm terrible with names™, so I won't be binding on this. Having said that, |
it has traditionally been used for "subprogram" as well, independently of call regularity I think it should be fine, the fact is slightly quirky make it so it's unlikely we will want to use it for something user oriented. @jhenstridge I would go ahead with As we said initially we want to put: |
9be3bd0
to
df14d68
Compare
I've updated the branch to use "snap routine" instead now, and work with the completion changes. I haven't added secondary registrations of |
at this point you should work with @chipaca and @mvo5 to push this forward, as I mentioned those commands will need to change a couple of bits of packaging (I don't know with what consequences) |
@jhenstridge please do adjust the PR description as well, I changed summary myself |
Just to confirm: the initial comment in the PR was edited as requested. |
@chipaca suggested I split this out from PR #7588 for independent review.
I want to add a
snap
subcommand that is not intended for use by humans. I also don't want to reserve command names that could be useful for future human-facing commands. The command is intended to offer an API that the caller can rely on too, so the `snap debug namespace seems inappropriate.This PR implements a proposal from @zyga to add a new namespace for such commands. After discussion in this PR, the decision was made to namespace these commands as
snap routine
.