On 1/13/25 11:05 PM, Ranuga D wrote:
Dear Coreutils Team,
I hope this message finds you well. I am writing to propose a feature
enhancement for the mkdir command. This enhancement introduces a new -a
option for handling single-directory names with spaces or special
formatting.
Proposed Functionality
1.
*Handling Spaces*: Create directories with spaces in their names without
requiring manual quoting or escaping.
Example:
mkdir "this is a single directory file name" -a
*Expected Result*: A directory named this is a single directory file name
is created.
If anything, what I would expect would be useful would be
$ mkdir -a this is a single directory file name
without quotes. Otherwise what have you accomplished? And even if this
were a good idea, "-a" is too short an option for it. The other
comments made were also well-taken: we'd need this on other commands,
and --convert-hyphens and whatever. Rob Landley's does *not* align with
your suggestion, but is better: Rob's function would let you say "x
mkdir a_b_c" to create directory named "a b c", while your description
of convert_hyphens below looks like you're expected to say 'mkdir -a "a
b c"' to create a directory named a_b_c, again not really helping in
terms of avoiding quotes. And something similar could be done for how I
understand your suggestion: x() { "$1" "$*" }, for the good that will do.
Why do you describe this as _avoiding_ escaping/quoting?
~mark
2.
*Replacing Spaces with Underscores*: Introduce an additional option (
--convert-underscores) to replace spaces with underscores in directory
names.
Example:
mkdir "this is a single directory file name" -a --convert-underscores
*Expected Result*: A directory named this_is_a_single_directory_file_name
is created.
Rationale
Currently, users must manually quote or escape directory names with spaces
or special characters, which can be inconvenient. This proposed feature
would:
- Simplify directory creation workflows.
- Improve usability for both interactive use and script-based
environments.
- Enhance compatibility with systems or workflows where spaces in names
can cause issues.
Benefits of the Feature
- Streamlines directory creation for names with spaces or special
characters.
- Reduces potential errors caused by unescaped characters.
- Provides additional flexibility for users managing directory names
programmatically.
Thank you for considering this feature request. I believe it could
significantly enhance the usability of the mkdir command. Please let me
know if additional information or clarification is required.
Looking forward to your feedback.
Best regards,
Ranuga Gamage
0777169804