Blog: 2023-08-01: Difference between revisions
(Created page with "Hacking on rust and having fun, while trying to debug this fish issue https://github.com/fish-shell/fish-shell/issues/7944 In this commit https://github.com/fish-shell/fish-s...") |
(No difference)
|
Revision as of 00:37, 1 August 2023
Hacking on rust and having fun, while trying to debug this fish issue https://github.com/fish-shell/fish-shell/issues/7944
In this commit https://github.com/fish-shell/fish-shell/commit/7fea321b3e58f5801bf7544d7e73cedbed5221df
I see a tmux test, good example of how to do this; useful idea for my editor-testing scheme.
Side quest meanwhile involves getting neovim config in lua - I wanted to use the clientserver feature to avoid having to do special handling to get the :drop command through to the parent vim in a vim terminal.
Now that fish is moving more to rust (rust overtook c++ in the last 2 weeks) I have renewed interest in that. Here's a tiny grep program from a rust commandline guide:
https://rust-cli.github.io/book/tutorial/impl-draft.html
use clap::Parser;
#[derive(Parser)]
struct Cli {
/// The pattern to look for
pattern: String,
/// The file being searched
path: std::path::PathBuf,
}
fn main() {
let args = Cli::parse();
println!("so you tryna search {} in {}", args.pattern, args.path.display());
let content = std::fs::read_to_string(&args.path).expect("unable to read file");
for line in content.lines() {
if line.contains(&args.pattern) {
println!("{}", line)
}
}
}