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

Allow specifying file name and format as cmd args for freeze, deduce format from filename #701

Merged

Conversation

dnaaun
Copy link
Contributor

@dnaaun dnaaun commented Jul 16, 2021

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:

  1. The -o / --save-to option. If the user doesn't provide it, we will prompt.
  2. The -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.
  3. The -y / --yes option. In addition to the prompts for the above two, we currently prompt for cofnrimation/warning two additional times when doing freeze. Specifying this -y flag avoids that.
  4. The -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:

bind -T root C-s run-shell "tmuxp freeze -yqo .tmuxp.yaml"

This silently saves the current session in the current working directory of tmux after pressing Ctrl-S.

@tony
Copy link
Member

tony commented Oct 30, 2021

@davidatbu Thank you!

I'm wondering why tests aren't showing up in GH actions. Can you try rebasing?

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@tony
Copy link
Member

tony commented Feb 22, 2022

@davidatbu Here is another ping, can you try giving this a rebase please?

@tony
Copy link
Member

tony commented Feb 22, 2022

test_cli.py issues to iron out, it seems

@tony
Copy link
Member

tony commented Feb 26, 2022

@davidatbu Sorry about this! This is extremely difficult to handle without a rebase, I don't have force push access to do it myself

I'd like you to get credit for the pull request being merged here but i may have to make a separate PR with this change.

@tony tony force-pushed the add-output-file-and-format-cmdline-options branch 2 times, most recently from b7081ac to 3fe3a0f Compare February 26, 2022 15:37
@tony
Copy link
Member

tony commented Feb 26, 2022

! This is extremely difficult to handle without a rebase, I don't have force push access to do it myself

I apparently do! Nice!

image

@tony tony force-pushed the add-output-file-and-format-cmdline-options branch from 3fe3a0f to a1e01ff Compare February 26, 2022 15:45
@codecov
Copy link

codecov bot commented Feb 26, 2022

Codecov Report

Merging #701 (0322895) into master (d2c1b56) will increase coverage by 0.05%.
The diff coverage is 73.52%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #701      +/-   ##
==========================================
+ Coverage   75.91%   75.96%   +0.05%     
==========================================
  Files           7        7              
  Lines        1179     1190      +11     
  Branches      306      311       +5     
==========================================
+ Hits          895      904       +9     
+ Misses        201      199       -2     
- Partials       83       87       +4     
Impacted Files Coverage Δ
tmuxp/cli.py 73.51% <73.52%> (+0.19%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d2c1b56...0322895. Read the comment docs.

@tony tony merged commit 4ad9d10 into tmux-python:master Feb 26, 2022
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.

None yet

3 participants