reduce duplication
This commit is contained in:
parent
d25ddb487e
commit
bdf01d18ce
1 changed files with 3 additions and 2 deletions
|
@ -60,15 +60,16 @@ where
|
|||
fn main() -> Result<(), Box<dyn std::error::Error>>{
|
||||
let cli = Cli::parse();
|
||||
let mut connection = Connection::new()?;
|
||||
let tree = connection.get_tree()?;
|
||||
|
||||
let node = match cli.use_field {
|
||||
UseField::Class => find_node(&connection.get_tree()?, |node: &Node| {
|
||||
UseField::Class => find_node(&tree, |node: &Node| {
|
||||
node.window_properties
|
||||
.as_ref()
|
||||
.and_then(|p| p.class.as_deref())
|
||||
== Some(&cli.identifier)
|
||||
}),
|
||||
UseField::AppId => find_node(&connection.get_tree()?, |node: &Node| {
|
||||
UseField::AppId => find_node(&tree, |node: &Node| {
|
||||
node.app_id.as_deref() == Some(&cli.identifier)
|
||||
}),
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue