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