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

[PowerRename] Random string values to file names #32836

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

jhirvioja
Copy link

@jhirvioja jhirvioja commented May 12, 2024

Summary of the Pull Request

This pull request introduces random string replacement to PowerRename. With the random button toggled on, user can use these values in the "Replace with" input to generate random values to file names:

  • ${rstringalnum=9} - Random string with uppercase letters, lowercase letters and 0-9 digits, customized length.

  • ${rstringalpha=13} - Random string with uppercase letters and lowercase letters, customized length.

  • ${rstringdigit=36} - Random string with 0-9 digits, customized length.

  • ${ruuidv4} - Random UUID according to v4 specification.

PR Checklist

Detailed Description of the Pull Request / Additional comments

  • I think this covers most use cases, as uppercase/lowercase is controlled by existing functionality, and curly brackets flavor of UUID can be added manually by user in the "Replace with" input if needed (all tested and working)

  • Enumerating and random strings toggle each other on/off, similar to uppercase/lowercase/etc. Unfortunately right now I don't have the time (or the knowledge) to look in to how to make them work together

  • Other UUID versions, like UUIDv5, can be added later. But in a sense UUIDv5 is no longer "random", so it might be better to do it in another issue, even probably in another subheading in the PowerRename tool tip. Just to be super clear to the user that it is not random

  • Tweaked the texts a little in the UI, in my opinion a little more clearer now, let me know if they make sense (my reasoning: when you click on enumerating icon, you are not actually just enumerating items like it used to be [0, 1 ... etc], you are also enabling the enumeration feature)

  • Combined with the date feature (f.e. $YYYY), it only works when added to the middle of values or end of the file name. There is an issue about this already: Power Rename Enumerate not working with dates and/or regex groups #28428, enumerator feat works in a similar way, so maybe an unified solution is possible (outside of this scope)

Validation Steps Performed

  • All unit tests pass
  • Tested manually with Windows 11 Pro x64 (W10 upgraded version)
    • renamed in various ways with a bunch of txt-files, subfolders, uppercase, lowercase, etc., works as intended

This comment has been minimized.

@jhirvioja
Copy link
Author

@microsoft-github-policy-service agree

@jhirvioja jhirvioja marked this pull request as ready for review May 12, 2024 14:48
@Jay-o-Way
Copy link
Collaborator

I think "rstringchar" should be "rstringalpha".

@jhirvioja
Copy link
Author

jhirvioja commented May 13, 2024

I think "rstringchar" should be "rstringalpha".

Hmm, right. In POSIX that implies uppercase letters as well, and the solution does not do that. But a character can indeed be numbers as well by definition.

Now that I think about it, should rstring (the basic one) actually be called rstringalnum, and add uppercase letters to there and to rstringalpha? And call rstringnum rstringdigit. That would be in line with POSIX altogether.

Before:

  • ${rstring=9} - abcdefghijklmnopqrstuvwxyz0123456789

  • ${rstringchar=13} - abcdefghijklmnopqrstuvwxyz

  • ${rstringnum=36} - 0123456789

After:

  • ${rstringalnum=9} - abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789

  • ${rstringalpha=13} - abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ

  • ${rstringdigit=36} - 0123456789

e: updated, looks a lot cleaner and opens up one more use case (upper- and lowercase letters mixed)

@htcfreek
Copy link
Collaborator

e: updated, looks a lot cleaner and opens up one more use case (upper- and lowercase letters mixed)

I can imagine that users need to decide if upper, lower or mixed case. Does a simple drop down setting in the ux makes sense?

@@ -363,4 +363,25 @@
<data name="RenameParts_ExtensionOnly.Content" xml:space="preserve">
<value>Extension only</value>
</data>
</root>
<data name="RandomizerCheatSheet_Alnum" xml:space="preserve">
<value>Random string with uppercase letters, lowercase letters and 0-9 digits, customized length.</value>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be as clear as possible it should contain the lengt the example defines.

"costumized length": Is there a default length? Otherwise it should not use the word customized.

My suggestion: "with a length of 9"

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's probably correct - what I used is more in line with the enumerating tool tip texts, so those should be changed as well. Should I?

f.e. (not exactly, but in the lines)
enumerating-tool-tip
-> "A counter which starts at value 10."

No default length, ${rstringalnum=0} and ${rstringalnum=} creates no random strings.

Copy link
Collaborator

@htcfreek htcfreek May 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope. Changing established phrases is out of scoope. Lets go with "customized length" for now.

We can create an issue for improving the help texts in a second step. I am sure there will be discussions about the best phrasing.

@jhirvioja
Copy link
Author

e: updated, looks a lot cleaner and opens up one more use case (upper- and lowercase letters mixed)

I can imagine that users need to decide if upper, lower or mixed case. Does a simple drop down setting in the ux makes sense?

I would probably keep it like it has been established, user can decide between mixed (default), lower case (toggle lower case button), upper case (toggle upper case button):
mixed-lower-upper

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