|
564 | 564 | <a href="#564" id="564">564</a>
|
565 | 565 | <a href="#565" id="565">565</a>
|
566 | 566 | <a href="#566" id="566">566</a>
|
| 567 | +<a href="#567" id="567">567</a> |
| 568 | +<a href="#568" id="568">568</a> |
567 | 569 | </pre><pre class="rust"><code><span class="comment">// * This file is part of the uutils coreutils package.
|
568 | 570 | // *
|
569 | 571 | // * (c) Alex Lyon <arcterus@mail.com>
|
|
573 | 575 |
|
574 | 576 | // spell-checker:ignore (path) eacces
|
575 | 577 |
|
576 |
| -</span><span class="kw">use </span>clap::{crate_version, parser::ValueSource, Arg, ArgAction, Command}; |
| 578 | +</span><span class="kw">use </span>clap::{builder::ValueParser, crate_version, parser::ValueSource, Arg, ArgAction, Command}; |
577 | 579 | <span class="kw">use </span>std::collections::VecDeque;
|
| 580 | +<span class="kw">use </span>std::ffi::{OsStr, OsString}; |
578 | 581 | <span class="kw">use </span>std::fs::{<span class="self">self</span>, File, Metadata};
|
579 | 582 | <span class="kw">use </span>std::io::ErrorKind;
|
580 | 583 | <span class="kw">use </span>std::ops::BitOr;
|
|
625 | 628 | </span><span class="kw">pub fn </span>uumain(args: <span class="kw">impl </span>uucore::Args) -> UResult<()> {
|
626 | 629 | <span class="kw">let </span>matches = uu_app().after_help(AFTER_HELP).try_get_matches_from(args)<span class="question-mark">?</span>;
|
627 | 630 |
|
628 |
| - <span class="kw">let </span>files: Vec<String> = matches |
629 |
| - .get_many::<String>(ARG_FILES) |
630 |
| - .map(|v| v.map(ToString::to_string).collect()) |
| 631 | + <span class="kw">let </span>files: Vec<<span class="kw-2">&</span>OsStr> = matches |
| 632 | + .get_many::<OsString>(ARG_FILES) |
| 633 | + .map(|v| v.map(OsString::as_os_str).collect()) |
631 | 634 | .unwrap_or_default();
|
632 | 635 |
|
633 | 636 | <span class="kw">let </span>force_flag = matches.get_flag(OPT_FORCE);
|
|
797 | 800 | .arg(
|
798 | 801 | Arg::new(ARG_FILES)
|
799 | 802 | .action(ArgAction::Append)
|
| 803 | + .value_parser(ValueParser::os_string()) |
800 | 804 | .num_args(<span class="number">1</span>..)
|
801 | 805 | .value_hint(clap::ValueHint::AnyPath),
|
802 | 806 | )
|
803 | 807 | }
|
804 | 808 |
|
805 | 809 | <span class="comment">// TODO: implement one-file-system (this may get partially implemented in walkdir)
|
806 |
| -</span><span class="kw">fn </span>remove(files: <span class="kw-2">&</span>[String], options: <span class="kw-2">&</span>Options) -> bool { |
| 810 | +</span><span class="kw">fn </span>remove(files: <span class="kw-2">&</span>[<span class="kw-2">&</span>OsStr], options: <span class="kw-2">&</span>Options) -> bool { |
807 | 811 | <span class="kw">let </span><span class="kw-2">mut </span>had_err = <span class="bool-val">false</span>;
|
808 | 812 |
|
809 | 813 | <span class="kw">for </span>filename <span class="kw">in </span>files {
|
|
0 commit comments