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

cli: Add --destructive-mode to clean #2577

Merged
merged 2 commits into from
Jun 4, 2019

Conversation

sparkiegeek
Copy link
Contributor

@sparkiegeek sparkiegeek commented May 29, 2019

Allow wrapper scripts to pass --destructive-mode to lifecycle commands

Fixes https://bugs.launchpad.net/snapcraft/+bug/1827191

  • [ ❌ ] Have you followed the guidelines for contributing?
  • [ ☑️ ] Have you signed the CLA?
  • [ ❌ ] Have you successfully run ./runtests.sh static?
  • [ ❌ ] Have you successfully run ./runtests.sh tests/unit?

@cjp256 cjp256 marked this pull request as ready for review May 29, 2019 13:20
@cjp256
Copy link
Contributor

cjp256 commented May 29, 2019

Excellent! I was just looking for an option like this yesterday :) Tested, LGTM.

Copy link
Contributor

@cjp256 cjp256 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

running static tests, I caught a formatting issue:

--- snapcraft/cli/lifecycle.py	2019-05-29 13:21:04.512712 +0000
+++ snapcraft/cli/lifecycle.py	2019-05-29 13:37:20.879088 +0000
@@ -305,11 +305,11 @@
 )
 @click.option(
     "--destructive-mode",
     is_flag=True,
     required=False,
-    help="Forces snapcraft to try and use the current host to build."
+    help="Forces snapcraft to try and use the current host to build.",
 )
 @click.option("--unprime", is_flag=True, required=False, cls=HiddenOption)
 def clean(parts, use_lxd, destructive_mode, unprime):
     """Remove a part's assets.
 
@@ -317,11 +317,12 @@
     Examples:
         snapcraft clean
         snapcraft clean my-part
     """
     build_environment = get_build_environment(
-        use_lxd=use_lxd, destructive_mode=destructive_mode)
+        use_lxd=use_lxd, destructive_mode=destructive_mode
+    )
     project = get_project(is_managed_host=build_environment.is_managed_host)
 
     if unprime and not build_environment.is_managed_host:
         raise click.BadOptionUsage("--unprime is not a valid option.")

@codecov-io
Copy link

codecov-io commented May 30, 2019

Codecov Report

Merging #2577 into master will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2577      +/-   ##
==========================================
+ Coverage   89.03%   89.06%   +0.02%     
==========================================
  Files         205      205              
  Lines       13986    13987       +1     
  Branches     2118     2118              
==========================================
+ Hits        12453    12458       +5     
+ Misses       1082     1080       -2     
+ Partials      451      449       -2
Impacted Files Coverage Δ
snapcraft/cli/lifecycle.py 86.86% <100%> (+0.09%) ⬆️
snapcraft/cli/_options.py 89.47% <0%> (+5.26%) ⬆️
snapcraft/cli/env.py 77.77% <0%> (+11.11%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a1cd034...cea45f8. Read the comment docs.

Allow wrapper scripts to pass --destructive-mode to lifecycle commands
@sparkiegeek sparkiegeek changed the title [cli] Add --destructive-mode to clean cli: Add --destructive-mode to clean May 30, 2019
@sergiusens sergiusens merged commit 2d661c7 into canonical:master Jun 4, 2019
clobrano pushed a commit to clobrano-forks/snapcraft that referenced this pull request Jun 8, 2019
Allow wrapper scripts to pass --destructive-mode to lifecycle commands
@sparkiegeek sparkiegeek deleted the clean-destructive branch June 10, 2019 09:27
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

Successfully merging this pull request may close these issues.

4 participants