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

iroh-cli: allow --switch outside of iroh console #2535

Closed
KAAtheWiseGit opened this issue Jul 23, 2024 · 5 comments
Closed

iroh-cli: allow --switch outside of iroh console #2535

KAAtheWiseGit opened this issue Jul 23, 2024 · 5 comments

Comments

@KAAtheWiseGit
Copy link

KAAtheWiseGit commented Jul 23, 2024

Currently, --switch flags don't work outside of the Iroh CLI console.

I want to suggest setting env variables for IROH_AUTHOR and IROH_DOC when a command with --switch is ran in the terminal.

Would the Iroh team be interested in a PR implementing this?

@flub
Copy link
Contributor

flub commented Jul 23, 2024

@flub
Copy link
Contributor

flub commented Jul 23, 2024

Admittedly this is not documented AFAIK, this is being changed in n0-computer/iroh.computer#166

@KAAtheWiseGit
Copy link
Author

@flub got it! In this case, I'll rewrite this issue into --switch support. From what I can see, this part isn't supported.

@KAAtheWiseGit KAAtheWiseGit changed the title iroh-cli: allow selecting author/document with env variables iroh-cli: allow --switch outside of iroh console Jul 23, 2024
@Frando
Copy link
Member

Frando commented Jul 26, 2024

I don't think it is possible for a process set environment variables in the surrounding shell?

If we wanted to support --switch for non-console CLI, we'd have to store and read the author and doc ids ourselves.. We decided against that, because we wanted the CLI commands to be predictable and only depend on the explicitly set shell environment and not on transient state in the iroh data dir.

@KAAtheWiseGit
Copy link
Author

Oh, right, I was working with Nushell and completely forgot it wasn't possible to set environmental variables in standalone commands.

I totally agree with not storing per-process data, it's too opaque. Will close the issue, as I don't see a good way to implement switching either.

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

No branches or pull requests

3 participants