Skip to content

Commit

Permalink
uninstall --yes
Browse files Browse the repository at this point in the history
  • Loading branch information
paugier committed Nov 6, 2024
1 parent a4f2fdb commit 19f12f4
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/unix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,14 @@ jobs:
- name: test install mercurial
run: |
conda-app install mercurial
conda-app list
- name: test install pipx
run: |
conda-app install pipx python=3.12
conda env list
conda-app list
pipx --version
conda-app uninstall pipx -y
- name: test installed mercurial
run: |
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,14 @@ jobs:
- name: test install mercurial
run: |
conda-app install mercurial
conda-app list
- name: test install pipx
run: |
conda-app install pipx python=3.12
conda env list
conda-app list
pipx --version
conda-app uninstall pipx -y
- name: test installed mercurial
run: |
Expand Down
2 changes: 2 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ test-run:
- conda-app install mercurial
- conda-app install pipx python=3.11
- conda env list
- pipx --version
- conda-app uninstall pipx -y
- . ~/.bashrc
- hg debuginstall
- mkdir -p $HOME/tmp
Expand Down
11 changes: 7 additions & 4 deletions src/conda_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,7 @@ def get_env_names(conda_data):
for path_envs_dir in conda_data["envs_dirs"]:
for path_env in envs:
if path_env.startswith(path_envs_dir):
path_env = path_env[len(path_envs_dir) + 1 :]
env_names.append(path_env)
env_names.append(path_env[len(path_envs_dir) + 1 :])
return env_names


Expand Down Expand Up @@ -375,7 +374,8 @@ def install(app_name, other_packages=None):

@main.command(context_settings=CONTEXT_SETTINGS)
@click.argument("app_name")
def uninstall(app_name):
@click.option("-y", "--yes", is_flag=True)
def uninstall(app_name, yes):
"""Uninstall an application."""
conda_data = get_conda_data()
env_names = get_env_names(conda_data)
Expand All @@ -386,7 +386,10 @@ def uninstall(app_name):
print(f"{app_name} not installed with conda-app: nothing to do")
return

if query_yes_no(f"The application {app_name} will be uninstalled.\nProceed"):
if not yes:
yes = query_yes_no(f"The application {app_name} will be uninstalled.\nProceed")

if yes:
import shutil

for env_path in conda_data["envs"]:
Expand Down

0 comments on commit 19f12f4

Please sign in to comment.