Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Gigas002
Copy link
Contributor

This PR adds optional file-name-format argument for CLI. Part of #104. Includes minor (no functional changes) renamings for readability.

The argument is completely optional and default (current) file name without it will be the same (wayshot-%Y_%m_%d-%H_%M_%S).

Except for changing the file name format, this PR adds support for using env vars and tilde in paths via shellexpand crate.

Supported cases examples:

  • no args provided: wayshot
  • file with encoding: wayshot 1.jpg
  • file with different encoding: wayshot 1.jpg --encoding png
  • file-name-format provided: wayshot --file-name-format %H
  • relative dir (must exist or will be treated as file): wayshot test/
  • relative file: wayshot test/1.jpg
  • full path: wayshot /home/user/wayshot/1.jpg
  • env vars: wayshot $HOME/wayshot/1.jpg
  • tilde: wayshot ~/wayshot/1.jpg

@rachancheet
Copy link
Contributor

I recommend using the --encoding flag over the extension in the file path when specifying the output format (e.g., wayshot 1.jpg --encoding png).

Everything else looks good to me. What do you think, @Shinyzenith ?

@Gigas002
Copy link
Contributor Author

Ah, I overlooked it, thanks!
Yes, the requested_encoding was superior before this change, so it has to be same here, I agree.

@Shinyzenith
Copy link
Member

changes) renamings for readability.

The

Nice catch --encoding should be respected first. If it doesn't exist then we auto accept whatever encoding is part of file extension path.

@Shinyzenith Shinyzenith merged commit 09b4e80 into waycrate:main Mar 22, 2025
4 checks passed
@Shinyzenith
Copy link
Member

Thank you for the amazing help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants