blob: 56e0eabaa90c41f334608d986fcf6751209848b6 [file] [log] [blame]
Simran Basif231db12015-09-23 11:38:14 -07001# Copyright (C) 2015 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
Simran Basif231db12015-09-23 11:38:14 -070015import sys
16
17from command import Command, GitcClientCommand
Renaud Paquaya65adf72016-11-03 10:37:53 -070018import platform_utils
Simran Basif231db12015-09-23 11:38:14 -070019
David Pursehouse819827a2020-02-12 15:20:19 +090020
Simran Basif231db12015-09-23 11:38:14 -070021class GitcDelete(Command, GitcClientCommand):
22 common = True
23 visible_everywhere = False
24 helpSummary = "Delete a GITC Client."
25 helpUsage = """
26%prog
27"""
28 helpDescription = """
29This subcommand deletes the current GITC client, deleting the GITC manifest
30and all locally downloaded sources.
31"""
32
33 def _Options(self, p):
34 p.add_option('-f', '--force',
35 dest='force', action='store_true',
36 help='Force the deletion (no prompt).')
37
38 def Execute(self, opt, args):
39 if not opt.force:
40 prompt = ('This will delete GITC client: %s\nAre you sure? (yes/no) ' %
41 self.gitc_manifest.gitc_client_name)
42 response = input(prompt).lower()
43 if not response == 'yes':
44 print('Response was not "yes"\n Exiting...')
45 sys.exit(1)
Renaud Paquaya65adf72016-11-03 10:37:53 -070046 platform_utils.rmtree(self.gitc_manifest.gitc_client_dir)