src/nitpick/project.py
def find_starting_dir(current_dir: PathOrStr) -> Path:
    """Find the starting dir from the current dir."""
    logger.debug(f"Searching root from current dir: {str(current_dir)!r}")
    all_files_dirs = list(Path(current_dir).glob("*"))
    logger.debug("All files/dirs in the current dir:\n{}", "\n".join(str(file) for file in all_files_dirs))

    # Don't fail if the current dir is empty
    starting_file = str(all_files_dirs[0]) if all_files_dirs else ""
    if starting_file:
        return Path(starting_file).parent.absolute()

    return Path(current_dir).absolute()
Find the starting dir from the current dir.
Find the starting dir from the current dir.
Find the starting dir from the current dir .
def find_starting_dir(current_dir: PathOrStr) -> Path:
    logger.debug(f"Searching root from current dir: {str(current_dir)!r}")
    all_files_dirs = list(Path(current_dir).glob("*"))
    logger.debug("All files/dirs in the current dir:\n{}", "\n".join(str(file) for file in all_files_dirs))
    starting_file = str(all_files_dirs[0]) if all_files_dirs else ""
    if starting_file:
        return Path(starting_file).parent.absolute()
    return Path(current_dir).absolute()
def find_starting_dir ( current_dir : PathOrStr ) -> Path : logger . debug ( f"Searching root from current dir: {str(current_dir)!r}" ) all_files_dirs = list ( Path ( current_dir ) . glob ( "*" ) ) logger . debug ( "All files/dirs in the current dir:\n{}" , "\n" . join ( str ( file ) for file in all_files_dirs ) ) starting_file = str ( all_files_dirs [ 0 ] ) if all_files_dirs else "" if starting_file : return Path ( starting_file ) . parent . absolute ( ) return Path ( current_dir ) . absolute ( )
Find the starting dir from the current dir.
Find the starting dir from the current dir .
"""Find the starting dir from the current dir.""" # Don't fail if the current dir is empty
current_dir
PathOrStr