From 3e790215b6a3af2725f83e31cae8d624ef780207 2012-11-22 14:46:43 From: Takafumi Arakaki Date: 2012-11-22 14:46:43 Subject: [PATCH] Add -u argument to %history magic --- diff --git a/IPython/core/magics/history.py b/IPython/core/magics/history.py index 3d9884d..63bb4fa 100644 --- a/IPython/core/magics/history.py +++ b/IPython/core/magics/history.py @@ -89,6 +89,11 @@ class HistoryMagics(Magics): get the last n lines from all sessions. Specify n as a single arg, or the default is the last 10 lines. """) + @argument( + '-u', dest='unique', action='store_true', + help=""" + when searching history using `-g`, show only unique history. + """) @argument('range', nargs='*') @skip_doctest @line_magic @@ -165,7 +170,7 @@ class HistoryMagics(Magics): else: pattern = "*" hist = history_manager.search(pattern, raw=raw, output=get_output, - n=limit) + n=limit, unique=args.unique) print_nums = True elif args.limit is not _unspecified: n = 10 if limit is None else limit