Skip to content

Instantly share code, notes, and snippets.

@jonasfrey
Created October 27, 2023 15:26
Show Gist options
  • Save jonasfrey/79fbb3f6d343134a20be0d91b5d334f5 to your computer and use it in GitHub Desktop.
Save jonasfrey/79fbb3f6d343134a20be0d91b5d334f5 to your computer and use it in GitHub Desktop.
git_status_in_subdirectories_using_deno
import {
f_o_command
} from "https://deno.land/x/[email protected]/mod.js"
let s_path = Deno.cwd();
for await(const o_entry of Deno.readDir(s_path)){
if(o_entry.isDirectory){
let s_path_folder = s_path + '/' + o_entry.name;
Deno.chdir(s_path_folder);
try {
let o_command = await f_o_command(`git status`)
if(o_command.s_stdout.includes('Changes not staged for commit:')){
console.log(s_path_folder)
console.log(o_command.s_stdout)
}else{
// console.log('nothing to commit, working tree clear')
}
} catch (error) {
if(!error.toString().includes('fatal: not a git repository')){
console.log(error)
}
// console.log(error)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment