sagiegurari / shell2batch

Coverts simple basic shell scripts to windows batch scripts.
Apache License 2.0
57 stars 7 forks source link

Non recursive cp #6

Closed roblabla closed 5 years ago

roblabla commented 5 years ago

Initial fix for non-recursive cp.

This doesn't work for multiple file copies yet though. For this, we'd need some way to generate a for loop with the arguments. E.G. cp test1 test2 test3 should generate for %I in (test1 test2) do copy %I test3. Two things necessary for this:

  1. We need a way to gather non-flag arguments - probably a simple regex of \b[^-]+ will do?
  2. Where do we insert the for loop? I suspect somewhere just before or after handling the flag replacement.
codecov-io commented 5 years ago

Codecov Report

Merging #6 into master will increase coverage by 0.03%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master       #6      +/-   ##
==========================================
+ Coverage   99.21%   99.24%   +0.03%     
==========================================
  Files           4        4              
  Lines         380      396      +16     
==========================================
+ Hits          377      393      +16     
  Misses          3        3
Impacted Files Coverage Δ
src/lib.rs 75% <ø> (ø) :arrow_up:
src/lib_test.rs 100% <100%> (ø) :arrow_up:
src/converter_test.rs 100% <100%> (ø) :arrow_up:
src/converter.rs 98.64% <100%> (+0.11%) :arrow_up:

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 7628971...3480072. Read the comment docs.

roblabla commented 5 years ago

example was fairly outdated (it panics on master I believe?), that's fixed. All tests were fixed (cargo test passes), and bench is now fixed.

Made a separate issue to track cp with multiple files, #7

roblabla commented 5 years ago

Alright, should be good to go!

roblabla commented 5 years ago

Got another problem. My rule is:

cp linker-scripts/bootstrap.ld link.T

This gets turned into an xcopy instead of a copy because of the - in the middle of the path, which ends up matching the regex.

I'm not 100% sure how to deal with this. I think the regex should be (^|\s)-[^ ]*[rR]?

sagiegurari commented 5 years ago

i'll merge this one and do some more changes/tests. then i'll add that custom convert hint i talked about and release a new version