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 option to start an interactive mommy session #46

Open
dsprenkels opened this issue Mar 1, 2023 · 2 comments
Open

add option to start an interactive mommy session #46

dsprenkels opened this issue Mar 1, 2023 · 2 comments
Assignees
Labels
feature New feature or request

Comments

@dsprenkels
Copy link
Contributor

dsprenkels commented Mar 1, 2023

It is usually desireable for mommy to be disabled by default, but sometimes you might like to enable it for a single session.
In these cases it might be nice to have a mommy [-i | --interactive] that starts a new shell with mommy enabled internally. The user should be able to exit that shell in the regular way, i.e., with exit.

@dsprenkels dsprenkels changed the title Add option to start an interactive mommy session add option to start an interactive mommy session Mar 1, 2023
@FWDekker FWDekker self-assigned this Mar 1, 2023
@FWDekker FWDekker added the feature New feature or request label Mar 1, 2023
@FWDekker
Copy link
Owner

FWDekker commented Mar 1, 2023

woah, awesome idea!

when you say "enabled", do you mean "act as if every command is prefixed by mommy"? because the way I have integrated mommy in my shell is the way it's explained in the fish section, which is different than passing each command through mommy.

an alternative would be to add the option mommy --gated (weird name, need a better one) which checks MOMMY_INTERACTIVE: if it is set and non-zero, mommy behaves as it does currently, but if not set or zero, it runs the command normally but without outputting anything. this way, you can just follow the integration steps in the shell integration section, but also add the --gated option so that mommy isn't actually enabled until you set MOMMY_INTERACTIVE=1 in your shell. which is kind of like running mommy -i, I guess. (unfortunately it is impossible to make mommy -i or any other command set the environment variable.)

i would also like a mommy -i command as you proposed, but I'm not sure it's feasible because I don't know a generic way for shells to always pass every command through mommy. you could maybe create some sort of shell wrapper so that after mommy -i each command you give the interactive session is passed to the shell of your choice, but then you cannot use environment variables :/ last option would be to create our own shell, but i really think that's out of scope for mommy.

maybe you have other solutions in mind?

@FWDekker
Copy link
Owner

ok, if you had to choose, would you rather:

  1. write mommy -t to toggle whether mommy is enabled in all shells by the current user, or
  2. write export MOMMY_ENABLED=0 or export MOMMY_ENABLED=1 to disable/enable mommy only in the current shell?

the former is much shorter, easier to remember, and easier to write, but there's no way to restrict the behaviour only to the current shell, so the state will be stored in a file, and apply to all shells by the current user. (i can also add mommy -t 0 and mommy -t 1 to not toggle but explicitly disable/enable.)

the latter is harder to use and just generally less nice, but will apply only to the current shell (and sub-shells).

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

No branches or pull requests

2 participants