Allow specifying file name and format as cmd args for freeze, deduce format from filename #701
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
First off, thanks for this Python solution to tmux session management! Works quite well.
tmuxp freeze
does a lot of prompting, but I wanted the option to not be prompted sometimes (for example, I want to setup a binding in tmux that saves the current session in the current directory, and I don't want to be prompted for file name / file format).So this commit adds the following:
-o
/--save-to
option. If the user doesn't provide it, we will prompt.-f
/--config-format
option. If the user doesn't provide it, we'll try to deduce it from the extension of the file specified by the--save-to
option. If that doesn't give a valid format, we prompt the user.-y
/--yes
option. In addition to the prompts for the above two, we currently prompt for cofnrimation/warning two additional times when doingfreeze
. Specifying this-y
flag avoids that.-q
/--quiet
option reduces some informative output. This is mostly a personal preference. I like my command line tools to be as quiet as possible.I haven't touched the tests here. I wanted to confirm that there was interest from the maintainers first.
A good demonstration of what the above changes enable is the following tmux mapping:
This silently saves the current session in the current working directory of tmux after pressing Ctrl-S.