Function cpp_linter::run::run_main

source ·
pub async fn run_main(args: Vec<String>) -> i32
Expand description

This is the backend entry point for console applications.

The idea here is that all functionality is implemented in Rust. However, passing command line arguments is done differently in Python or Rust.

  • In python, the sys.argv list is passed from the cpp_linter.entry_point.main() function to rust via the cpp_linter.run.main() binding (which wraps run_main()).
  • In rust, the std::env::args is passed to run_main() in the binary source main.rs.

This is done because of the way the python entry point is invoked. If std::env::args is used instead of python’s sys.argv, then the list of strings includes the entry point alias (“path/to/cpp-linter.exe”). Thus, the parser in crate::cli will halt on an error because it is not configured to handle positional arguments.