Open JustFrederik opened 3 weeks ago
it would be great if there could be auto task detection for shebangs. I listed some common file extensions for shebang below.
check files with a function for shebang like this
fn get_shebang<'a>(s: &'a str) -> Option<&'a str> { let line = s.split_once("\n")?.0; line.strip_prefix("#!") } fn get_shebang_args(s: &str) -> (&str, Vec<&str>) { let mut parts = s.split(" "); let shebang = parts.next().unwrap(); (shebang, parts.collect()) }
this could be for No extension, ".sh", ".bash", ".py", ".pl", ".rb",".php",".awk",".tcl",".r",".lua", ".groovy" and custom extensions from config.
EDIT: or executable text files(chmod +x)
the task would then execute something like Command::new(shebang).args(shebang_args).arg(absolute_path_to_file)
Potentially instead of detecting purely based on filename it could also check the mode (+x) of the file.
+x
Check for existing issues
Describe the feature
it would be great if there could be auto task detection for shebangs. I listed some common file extensions for shebang below.
If applicable, add mockups / screenshots to help present your vision of the feature
check files with a function for shebang like this
this could be for No extension, ".sh", ".bash", ".py", ".pl", ".rb",".php",".awk",".tcl",".r",".lua", ".groovy" and custom extensions from config.
EDIT: or executable text files(chmod +x)
the task would then execute something like Command::new(shebang).args(shebang_args).arg(absolute_path_to_file)