improv: Separate components & merge plugins binary with launcher service
This commit is contained in:
parent
43a4229ba7
commit
88acf0a74e
41 changed files with 219 additions and 152 deletions
14
bin/Cargo.toml
Normal file
14
bin/Cargo.toml
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
[package]
|
||||
name = "pop-launcher-bin"
|
||||
version = "1.0.0"
|
||||
edition = "2018"
|
||||
publish = false
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
pop-launcher-plugins = { path = "../plugins" }
|
||||
pop-launcher-service = { path = "../service" }
|
||||
smol = "1"
|
||||
tracing = "0.1"
|
||||
tracing-subscriber = "0.2"
|
||||
31
bin/src/main.rs
Normal file
31
bin/src/main.rs
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
use pop_launcher_plugins as plugins;
|
||||
use pop_launcher_service::Service;
|
||||
use smol::block_on;
|
||||
use std::io;
|
||||
|
||||
fn main() {
|
||||
tracing_subscriber::fmt()
|
||||
.with_writer(io::stderr)
|
||||
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
|
||||
.init();
|
||||
|
||||
std::env::args();
|
||||
|
||||
if let Some(plugin) = std::env::args().next() {
|
||||
let start = plugin.rfind('/').map(|v| v + 1).unwrap_or(0);
|
||||
let cmd = &plugin.as_str()[start..];
|
||||
match cmd {
|
||||
"pop-launcher" => {
|
||||
let stdout = io::stdout();
|
||||
block_on(Service::new(stdout.lock()).exec())
|
||||
},
|
||||
"desktop-entries" => block_on(plugins::desktop_entries::main()),
|
||||
"pop-shell" => block_on(plugins::pop_shell::main()),
|
||||
"find" => block_on(plugins::find::main()),
|
||||
"scripts" => block_on(plugins::scripts::main()),
|
||||
unknown => {
|
||||
eprintln!("unknown cmd: {}", unknown);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue