@@ -154,7 +154,13 @@ def build(ctx, max_revisions, targets, operators, archiver):
154154@click .option (
155155 "-m" , "--message/--no-message" , default = False , help = _ ("Include revision message" )
156156)
157- def index (ctx , message ):
157+ @click .option (
158+ "-w" ,
159+ "--wrap/--no-wrap" ,
160+ default = True ,
161+ help = _ ("Wrap index text to fit in terminal" ),
162+ )
163+ def index (ctx , message , wrap ):
158164 """Show the history archive in the .wily/ folder."""
159165 config = ctx .obj ["CONFIG" ]
160166
@@ -163,7 +169,7 @@ def index(ctx, message):
163169
164170 from wily .commands .index import index
165171
166- index (config = config , include_message = message )
172+ index (config = config , include_message = message , wrap = wrap )
167173
168174
169175@cli .command (
@@ -206,8 +212,14 @@ def index(ctx, message):
206212 help = _ ("Return a non-zero exit code under the specified threshold" ),
207213 type = click .INT ,
208214)
215+ @click .option (
216+ "-w" ,
217+ "--wrap/--no-wrap" ,
218+ default = True ,
219+ help = _ ("Wrap rank text to fit in terminal" ),
220+ )
209221@click .pass_context
210- def rank (ctx , path , metric , revision , limit , desc , threshold ):
222+ def rank (ctx , path , metric , revision , limit , desc , threshold , wrap ):
211223 """Rank files, methods and functions in order of any metrics, e.g. complexity."""
212224 config = ctx .obj ["CONFIG" ]
213225
@@ -225,6 +237,7 @@ def rank(ctx, path, metric, revision, limit, desc, threshold):
225237 limit = limit ,
226238 threshold = threshold ,
227239 descending = desc ,
240+ wrap = wrap ,
228241 )
229242
230243
@@ -260,9 +273,15 @@ def rank(ctx, path, metric, revision, limit, desc, threshold):
260273 default = False ,
261274 help = _ ("Only show revisions that have changes" ),
262275)
276+ @click .option (
277+ "-w" ,
278+ "--wrap/--no-wrap" ,
279+ default = True ,
280+ help = _ ("Wrap report text to fit in terminal" ),
281+ )
263282@click .pass_context
264283def report (
265- ctx , file , metrics , number , message , format , console_format , output , changes
284+ ctx , file , metrics , number , message , format , console_format , output , changes , wrap
266285):
267286 """Show metrics for a given file."""
268287 config = ctx .obj ["CONFIG" ]
@@ -297,6 +316,7 @@ def report(
297316 format = ReportFormat [format ],
298317 console_format = style ,
299318 changes_only = changes ,
319+ wrap = wrap ,
300320 )
301321
302322
@@ -322,8 +342,14 @@ def report(
322342@click .option (
323343 "-r" , "--revision" , help = _ ("Compare against specific revision" ), type = click .STRING
324344)
345+ @click .option (
346+ "-w" ,
347+ "--wrap/--no-wrap" ,
348+ default = True ,
349+ help = _ ("Wrap diff text to fit in terminal" ),
350+ )
325351@click .pass_context
326- def diff (ctx , files , metrics , all , detail , revision ):
352+ def diff (ctx , files , metrics , all , detail , revision , wrap ):
327353 """Show the differences in metrics for each file."""
328354 config = ctx .obj ["CONFIG" ]
329355
@@ -347,6 +373,7 @@ def diff(ctx, files, metrics, all, detail, revision):
347373 changes_only = not all ,
348374 detail = detail ,
349375 revision = revision ,
376+ wrap = wrap ,
350377 )
351378
352379
@@ -432,8 +459,14 @@ def clean(ctx, yes):
432459
433460
434461@cli .command ("list-metrics" , help = _ ("""List the available metrics.""" ))
462+ @click .option (
463+ "-w" ,
464+ "--wrap/--no-wrap" ,
465+ default = True ,
466+ help = _ ("Wrap metrics text to fit in terminal" ),
467+ )
435468@click .pass_context
436- def list_metrics (ctx ):
469+ def list_metrics (ctx , wrap ):
437470 """List the available metrics."""
438471 config = ctx .obj ["CONFIG" ]
439472
@@ -442,7 +475,7 @@ def list_metrics(ctx):
442475
443476 from wily .commands .list_metrics import list_metrics
444477
445- list_metrics ()
478+ list_metrics (wrap )
446479
447480
448481@cli .command ("setup" , help = _ ("""Run a guided setup to build the wily cache.""" ))
0 commit comments