@@ -96,7 +96,6 @@ The ``conan clean`` command has the following code:
96
96
from conan.api.conan_api import ConanAPI
97
97
from conan.api.output import ConanOutput, Color
98
98
from conan.cli.command import OnceArgument, conan_command
99
- from conans.client.userio import UserInput
100
99
101
100
102
101
recipe_color = Color.BRIGHT_BLUE
@@ -111,23 +110,14 @@ The ``conan clean`` command has the following code:
111
110
"""
112
111
parser.add_argument(' -r' , ' --remote' , action = OnceArgument,
113
112
help = ' Will remove from the specified remote' )
114
- parser.add_argument(' --force' , default = False , action = ' store_true' ,
115
- help = ' Remove without requesting a confirmation' )
116
113
args = parser.parse_args(* args)
117
114
118
- def confirmation (message ):
119
- return args.force or ui.request_boolean(message)
120
-
121
- ui = UserInput(non_interactive = False )
122
115
out = ConanOutput()
123
116
remote = conan_api.remotes.get(args.remote) if args.remote else None
124
117
output_remote = remote or " Local cache"
125
118
126
119
# Getting all the recipes
127
120
recipes = conan_api.search.recipes(" */*" , remote = remote)
128
- if recipes and not confirmation(" Do you want to remove all the recipes revisions and their packages ones, "
129
- " except the latest package revision from the latest recipe one?" ):
130
- return
131
121
for recipe in recipes:
132
122
out.writeln(f " { str (recipe)} " , fg = recipe_color)
133
123
all_rrevs = conan_api.list.recipe_revisions(recipe, remote = remote)
@@ -158,23 +148,12 @@ The ``parser`` param is an instance of the Python command-line parsing ``argpars
158
148
so if you want to know more about its API, visit `its official website <https://docs.python.org/3/library/argparse.html >`_.
159
149
160
150
161
- User input and user output
162
- ++++++++++++++++++++++++++
163
-
164
- Important classes to manage user input and user output:
165
-
166
- .. code-block :: python
167
-
168
- ui = UserInput(non_interactive = False )
169
- out = ConanOutput()
170
-
151
+ User output
152
+ +++++++++++
171
153
172
- * ``UserInput(non_interactive) ``: class to manage user inputs. In this example we're using ``ui.request_boolean("Do you want to proceed?") ``,
173
- so it'll be automatically translated to ``Do you want to proceed? (yes/no): `` in the command prompt.
174
- **Note **: you can use ``UserInput(non_interactive=conan_api.config.get("core:non_interactive")) `` too.
175
- * ``ConanOutput() ``: class to manage user outputs. In this example, we're using only ``out.writeln(message, fg=None, bg=None) ``
176
- where ``fg `` is the font foreground, and ``bg `` is the font background. Apart from that, you have some predefined methods
177
- like ``out.info() ``, ``out.success() ``, ``out.error() ``, etc.
154
+ ``ConanOutput() ``: class to manage user outputs. In this example, we're using only ``out.writeln(message, fg=None, bg=None) ``
155
+ where ``fg `` is the font foreground, and ``bg `` is the font background. Apart from that, you have some predefined methods
156
+ like ``out.info() ``, ``out.success() ``, ``out.error() ``, etc.
178
157
179
158
180
159
Conan public API
0 commit comments