Skip to content

Commit

Permalink
feat: auto keypress
Browse files Browse the repository at this point in the history
  • Loading branch information
mrchantey committed Oct 2, 2024
1 parent e7f8632 commit 2720dee
Show file tree
Hide file tree
Showing 11 changed files with 409 additions and 10 deletions.
215 changes: 215 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions crates/forky_cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ colorize = { workspace = true }
## style
cssparser = { workspace = true }

## key
enigo = "0.2.1"

## serve
axum = { workspace = true }
axum-server = { workspace = true }
Expand Down
6 changes: 3 additions & 3 deletions crates/forky_cli/examples/cli.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use forky_cli::*;
use forky_fs::*;
use ::forky_cli::prelude::*;
use forky_fs::prelude::*;

fn main() -> anyhow::Result<()> { common::ForkyCli.run_with_cli_args() }
fn main() -> anyhow::Result<()> { ForkyCli.run_with_cli_args() }
1 change: 1 addition & 0 deletions crates/forky_cli/src/auto_mod/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pub fn run() -> Result<()> {
Ok(dirs) => dirs
.map(|e| e.unwrap().path())
.for_each(|p| run_for_crate(p)),
// what does this do?
_ => run_for_crate(env::current_dir()?),
}
Ok(())
Expand Down
1 change: 1 addition & 0 deletions crates/forky_cli/src/common/forky_cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ impl Subcommand for ForkyCli {
Box::new(server::ServerCommand),
Box::new(style::StyleCommand),
Box::new(auto_mod::AutoModCommand),
Box::new(key::AutoKeyCommand),
]
}
}
26 changes: 26 additions & 0 deletions crates/forky_cli/src/key/command.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
use super::*;
use anyhow::Result;
use enigo::*;
use forky_fs::prelude::*;
pub struct AutoKeyCommand;


impl Subcommand for AutoKeyCommand {
fn name(&self) -> &'static str { "key" }
fn about(&self) -> &'static str { "automate keypresses" }

fn run(&self, _args: &clap::ArgMatches) -> Result<()> {
InputSequence::default()
// exit dock
.input(Key::Escape)
.ulaunch(1, "r beetmash-biz")
.ulaunch(2, "r beetmash-api")
.ulaunch(3, "r beetmash-site")
.ulaunch(4, "r beetmash")
.ulaunch(5, "r beet")
// .command("code /home/pete/me/beetmash-biz")
// .command("cd ~ && code .")
.run()?;
Ok(())
}
}
Loading

0 comments on commit 2720dee

Please sign in to comment.