Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh codespace and git status wrappers #16

Open
isedwards opened this issue Mar 20, 2023 · 0 comments
Open

gh codespace and git status wrappers #16

isedwards opened this issue Mar 20, 2023 · 0 comments

Comments

@isedwards
Copy link
Contributor

isedwards commented Mar 20, 2023

Implement a wrapper around GitHub CLI's gh codespace and git status -s:

  1. opencdms codespace status - show git status -s for all git repositories in /workspaces/

    Wrap the command below in Python

    find /workspaces -type d -name '.git' | while read dir ; do sh -c "cd $dir/../ && echo \"${dir//\.git/}\" && git status -s" ; done
    

    ... and only display lines starting with / if the next line does not start with '/'.

  2. opencdms codespace delete - delete current codespace if no changes in any repos in /workspaces/

    We can delete the current codespace container with:
    gh codespace delete -c $CODESPACE_NAME

    Offer -f and --force options to kill the container even if code changes exist.

Note:

  • Install GH cli with these instructions:
    type -p curl >/dev/null || sudo apt install curl -y
    curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
    && sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
    && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
    && sudo apt update \
    && sudo apt install gh -y
    
@isedwards isedwards changed the title opencdms cli: report if any code changes in the workspace gh codespace and git status wrapper Mar 21, 2023
@isedwards isedwards changed the title gh codespace and git status wrapper gh codespace and git status wrappers Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant