This commit is contained in:
sylvestre
2023-05-19 02:37:19 +00:00
parent a5050e481e
commit 7ee05d72bf
11 changed files with 52 additions and 14 deletions
+15 -1
View File
@@ -582,6 +582,13 @@
<a href="#582" id="582">582</a>
<a href="#583" id="583">583</a>
<a href="#584" id="584">584</a>
<a href="#585" id="585">585</a>
<a href="#586" id="586">586</a>
<a href="#587" id="587">587</a>
<a href="#588" id="588">588</a>
<a href="#589" id="589">589</a>
<a href="#590" id="590">590</a>
<a href="#591" id="591">591</a>
</pre><pre class="rust"><code><span class="comment">// This file is part of the uutils coreutils package.
//
// (c) Sunrin SHIMURA
@@ -775,7 +782,14 @@
(tmpdir, template.to_string())
}
<span class="prelude-val">Some</span>(template) =&gt; {
<span class="kw">let </span>tmpdir = matches.get_one::&lt;String&gt;(OPT_TMPDIR).map(String::from);
<span class="kw">let </span>tmpdir = <span class="kw">if </span>matches.contains_id(OPT_TMPDIR) {
matches.get_one::&lt;String&gt;(OPT_TMPDIR).map(String::from)
} <span class="kw">else if </span>matches.get_flag(OPT_T) {
<span class="comment">// mktemp -t foo.xxx should export in TMPDIR
</span><span class="prelude-val">Some</span>(env::temp_dir().display().to_string())
} <span class="kw">else </span>{
matches.get_one::&lt;String&gt;(OPT_TMPDIR).map(String::from)
};
(tmpdir, template.to_string())
}
}
+20
View File
@@ -513,6 +513,16 @@
<a href="#513" id="513">513</a>
<a href="#514" id="514">514</a>
<a href="#515" id="515">515</a>
<a href="#516" id="516">516</a>
<a href="#517" id="517">517</a>
<a href="#518" id="518">518</a>
<a href="#519" id="519">519</a>
<a href="#520" id="520">520</a>
<a href="#521" id="521">521</a>
<a href="#522" id="522">522</a>
<a href="#523" id="523">523</a>
<a href="#524" id="524">524</a>
<a href="#525" id="525">525</a>
</pre><pre class="rust"><code><span class="comment">// * This file is part of the uutils coreutils package.
// *
// * (c) Martin Kysel &lt;code@martinkysel.com&gt;
@@ -772,6 +782,11 @@
modifiers: KeyModifiers::NONE,
..
})
| Event::Key(KeyEvent {
code: KeyCode::PageDown,
modifiers: KeyModifiers::NONE,
..
})
| Event::Key(KeyEvent {
code: KeyCode::Char(<span class="string">&#39; &#39;</span>),
modifiers: KeyModifiers::NONE,
@@ -787,6 +802,11 @@
code: KeyCode::Up,
modifiers: KeyModifiers::NONE,
..
})
| Event::Key(KeyEvent {
code: KeyCode::PageUp,
modifiers: KeyModifiers::NONE,
..
}) =&gt; {
pager.page_up();
}
+9 -5
View File
@@ -564,6 +564,8 @@
<a href="#564" id="564">564</a>
<a href="#565" id="565">565</a>
<a href="#566" id="566">566</a>
<a href="#567" id="567">567</a>
<a href="#568" id="568">568</a>
</pre><pre class="rust"><code><span class="comment">// * This file is part of the uutils coreutils package.
// *
// * (c) Alex Lyon &lt;arcterus@mail.com&gt;
@@ -573,8 +575,9 @@
// spell-checker:ignore (path) eacces
</span><span class="kw">use </span>clap::{crate_version, parser::ValueSource, Arg, ArgAction, Command};
</span><span class="kw">use </span>clap::{builder::ValueParser, crate_version, parser::ValueSource, Arg, ArgAction, Command};
<span class="kw">use </span>std::collections::VecDeque;
<span class="kw">use </span>std::ffi::{OsStr, OsString};
<span class="kw">use </span>std::fs::{<span class="self">self</span>, File, Metadata};
<span class="kw">use </span>std::io::ErrorKind;
<span class="kw">use </span>std::ops::BitOr;
@@ -625,9 +628,9 @@
</span><span class="kw">pub fn </span>uumain(args: <span class="kw">impl </span>uucore::Args) -&gt; UResult&lt;()&gt; {
<span class="kw">let </span>matches = uu_app().after_help(AFTER_HELP).try_get_matches_from(args)<span class="question-mark">?</span>;
<span class="kw">let </span>files: Vec&lt;String&gt; = matches
.get_many::&lt;String&gt;(ARG_FILES)
.map(|v| v.map(ToString::to_string).collect())
<span class="kw">let </span>files: Vec&lt;<span class="kw-2">&amp;</span>OsStr&gt; = matches
.get_many::&lt;OsString&gt;(ARG_FILES)
.map(|v| v.map(OsString::as_os_str).collect())
.unwrap_or_default();
<span class="kw">let </span>force_flag = matches.get_flag(OPT_FORCE);
@@ -797,13 +800,14 @@
.arg(
Arg::new(ARG_FILES)
.action(ArgAction::Append)
.value_parser(ValueParser::os_string())
.num_args(<span class="number">1</span>..)
.value_hint(clap::ValueHint::AnyPath),
)
}
<span class="comment">// TODO: implement one-file-system (this may get partially implemented in walkdir)
</span><span class="kw">fn </span>remove(files: <span class="kw-2">&amp;</span>[String], options: <span class="kw-2">&amp;</span>Options) -&gt; bool {
</span><span class="kw">fn </span>remove(files: <span class="kw-2">&amp;</span>[<span class="kw-2">&amp;</span>OsStr], options: <span class="kw-2">&amp;</span>Options) -&gt; bool {
<span class="kw">let </span><span class="kw-2">mut </span>had_err = <span class="bool-val">false</span>;
<span class="kw">for </span>filename <span class="kw">in </span>files {
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long