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 the ability to add additional identities via the command line #413

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rustafariandev
Copy link

No description provided.

@@ -114,6 +114,10 @@ def create_agent_parser(device_type):

p.add_argument('identity', type=_to_unicode, default=None,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be simpler to add nargs='+' to the existing identity argument:

p.add_argument('identity', type=_to_unicode, default=None, nargs='+',
               help='proto://[user@]host[:port][/path]')

See https://docs.python.org/3/library/argparse.html#nargs

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me test how that works.

@rustafariandev
Copy link
Author

That conflicts with the other nargs argument at

p.add_argument('command', type=str, nargs='*', metavar='ARGUMENT',

import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-c', action='store_true')
parser.add_argument('foo', nargs='+')
parser.add_argument('bar', nargs='*', metavar='ARGUMENT')
print(parser.parse_args('-c c a b --  1 2 3'.split()))

The output

Namespace(c=True, foo=['c', 'a', 'b', '1', '2', '3'], bar=[])

@romanz
Copy link
Owner

romanz commented Feb 5, 2023

You're right - it won't work :(

@romanz
Copy link
Owner

romanz commented Feb 5, 2023

Can you export you relevant identities/pubkeys into a text file?
(see #115 for the discussion & #116 for the implementation)

@rustafariandev
Copy link
Author

Yes, I can. This was more for convenience than anything else.
It was to avoid me doing something like this.

onlykey-agent  <(echo "<[email protected]|ed25519>";echo "<[email protected]|ed25519>") --shell

Or creating the file ahead of time.

The file approach also works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants