From f0d5bd12b02a7ecd585437640e9932d090551eb3 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Thu, 6 Jun 2024 10:17:02 +0200 Subject: [PATCH] browse --- cd/__init__.py | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/cd/__init__.py b/cd/__init__.py index 840d848..38a6672 100644 --- a/cd/__init__.py +++ b/cd/__init__.py @@ -13,18 +13,7 @@ project = Project(projects) def cd_browse_workspace(): - print(f'''\ -{project.root} -↓ -''', end=str()) - paths = [] - for directory, directories, files in os.walk(project.root): - for file in files: - absolute_path = os.path.join(directory, file) - relative_path = os.path.relpath(absolute_path, start=project.root) - paths.append(relative_path) - for path in sorted(paths): - print(path) + browse(project.root) def cd_build_project(): @@ -75,6 +64,19 @@ def cd_synchronize(): ) +def browse(root: str): + paths = [] + for directory, _, files in os.walk(root): + for file in files: + absolute_path = os.path.join(directory, file) + relative_path = os.path.relpath(absolute_path, start=root) + paths.append(relative_path) + open(path) + for path in sorted(paths): + print(path) + shut(path) + + def install_commands(path): step('Install commands') user = '/usr/local/bin' @@ -111,6 +113,8 @@ def set_ssh(*arguments): if ssh_hosts: fs.write(known, ssh_hosts) os.chmod(known, 0o400) + # + browse(home) def open(*arguments):