@@ -468,13 +468,17 @@ def cmd_requests(args):
468468 statuses = {s .lower () for s in args .status }
469469 reqs = [r for r in reqs if r .get ("status" , "" ).lower () in statuses ]
470470
471- limit = args .n
472- truncated = len (reqs ) > limit
473- reqs = reqs [:limit ]
474-
475- print (format_request_table (reqs , show_legend = True ))
476- if truncated :
477- print (f"\n (showing { limit } most recent — use -n to change limit)" )
471+ reqs .sort (key = lambda r : r .get ("createdAt" ) or "" , reverse = True )
472+
473+ if not args .all :
474+ limit = args .n
475+ truncated = len (reqs ) > limit
476+ reqs = reqs [:limit ]
477+ print (format_request_table (reqs , show_legend = True ))
478+ if truncated :
479+ print (f"\n (showing { limit } most recent — use --all to show all or -n to change limit)" )
480+ else :
481+ print (format_request_table (reqs , show_legend = True ))
478482
479483
480484def cmd_status (args ):
@@ -857,6 +861,8 @@ def build_parser() -> argparse.ArgumentParser:
857861 description = "Show your elevation requests with status, account, role, and timestamps." )
858862 requests_parser .add_argument ("-n" , type = int , default = 10 , metavar = "N" ,
859863 help = "Max number of requests to show (default: 10)" )
864+ requests_parser .add_argument ("--all" , action = "store_true" ,
865+ help = "Show all requests (ignores -n)" )
860866 requests_parser .add_argument ("--status" , action = "append" , metavar = "STATUS" ,
861867 help = "Filter by status; can be repeated. "
862868 "Allowed: pending, approved, rejected, revoked, cancelled, in progress, scheduled, ended, expired" )
0 commit comments