coreutils icon indicating copy to clipboard operation
coreutils copied to clipboard

mktemp: Fix behavior of short-long options of tmpdir

Open dmatos2012 opened this issue 2 years ago • 4 comments

Hi, This PR started addressing issue #4175, which it fixed but I tried to go a bit further when tinkering with the ways tmpdir option is given.

Previously using something such as mktemp -p <path> --tmpdir <path2> would error out since from claps perspective its a single option used twice. However, this is very much allowed in GNU. Therefore, I managed to include that behavior by adding a second short flag -p and use independent of --tmpdir, as suggested by @tertsdiepraam.

I also managed to remove some of the previous workarounds to solve some other issues, but of course introduced some new workarounds.

One last note, is that this introduces a bit of undesired empty line (see after -p <DIR>) in the help message due to the new argument, that I am not sure how to fix, so if anyone knows how to, please feel free to help :D

uu_mktemp --help yields now

.....
  -p <DIR>   
      --tmpdir[=<DIR>]   interpret TEMPLATE relative to DIR.....
....

instead of the way before

-p , --tmpdir [<DIR>] interpret TEMPLATE relative to DIR......

dmatos2012 avatar Jan 11 '23 20:01 dmatos2012

Cool! I think we "fixed" the empty line is other utils by just adding a help string for -p. Something like "Same as `--tmpdir`"

tertsdiepraam avatar Jan 11 '23 23:01 tertsdiepraam

Yeah good idea, i have added that , should be ready :)

dmatos2012 avatar Jan 14 '23 17:01 dmatos2012

@dmatos2012 ping?

sylvestre avatar Mar 27 '23 19:03 sylvestre

@sylvestre as far as I was concerned, these changes were going to be merged from PR #4342 . @tertsdiepraam mentioned the approach there was better and copy the tests from here, so I assumed there was nothing to be done from me here :). Check that PR for details

dmatos2012 avatar Mar 29 '23 18:03 dmatos2012

Closing this PR as it is replaced by #4342. Thanks anyway for your PR :)

cakebaker avatar Jun 23 '23 13:06 cakebaker