summaryrefslogtreecommitdiff
path: root/rust-src/src/cmd_main.rs
AgeCommit message (Collapse)Author
2024-01-16convert main() from C to RustThomas Bertschinger
This moves the main() function from C to Rust. It also updates the name of the Rust package from "bcachefs-rust" to "bcachefs-tools". Signed-off-by: Thomas Bertschinger <tahbertschinger@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-01-07create common entry point for Rust commandsThomas Bertschinger
The bcachefs sub-commands that are implemented in Rust (completions, list, and mount) had separate entrypoints and thus had some differences in behavior. This introduces a common entry point for the Rust sub-commands. This reduces duplicate boilerplate code like parsing argv and setting up logging, and will facilitate converting more sub-commands to Rust in the future. An immediate benefit is that this fixes an issue with `bcachefs list` not reporting errors: before: $ bcachefs list /dev/typo $ echo $? 0 after: $ bcachefs list /dev/typo ERROR - bcachefs_rust::cmd_list: Fatal error: "No such file or directory" $ echo $? 1 Signed-off-by: Thomas Bertschinger <tahbertschinger@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>