workflow_utils/arglist.rs
1use crate::imports::*;
2
3/// Accumulator for command-line arguments; converting it into a `Vec<String>`
4/// de-duplicates the collected entries.
5#[derive(Default)]
6pub struct Arglist {
7 /// The arguments collected so far, in insertion order.
8 pub args: Vec<String>,
9}
10
11impl Arglist {
12 /// Appends an argument to the list.
13 pub fn push(&mut self, arg: impl Into<String>) {
14 self.args.push(arg.into());
15 }
16}
17
18impl From<Arglist> for Vec<String> {
19 fn from(arglist: Arglist) -> Self {
20 let mut args = AHashSet::new();
21 for arg in arglist.args.into_iter() {
22 args.insert(arg);
23 }
24 args.into_iter().collect()
25 }
26}