@@ -11,11 +11,11 @@ namespace InEngine.Core.Queuing.Commands
1111{
1212 public class Peek : AbstractCommand
1313 {
14- [ Option ( "offset " , DefaultValue = 0 , HelpText = "The maximum number of messages to peek." ) ]
15- public long Offset { get ; set ; }
14+ [ Option ( "from " , DefaultValue = 0 , HelpText = "The first message to peek at (0-indexed) ." ) ]
15+ public long From { get ; set ; }
1616
17- [ Option ( "limit " , DefaultValue = 10 , HelpText = "The maximum number of messages to peek." ) ]
18- public long Limit { get ; set ; }
17+ [ Option ( "to " , DefaultValue = 10 , HelpText = "The last message to peek at ." ) ]
18+ public long To { get ; set ; }
1919
2020 [ Option ( "json" , HelpText = "View the messages as JSON." ) ]
2121 public bool JsonFormat { get ; set ; }
@@ -34,19 +34,24 @@ public class Peek : AbstractCommand
3434
3535 public override void Run ( )
3636 {
37+ if ( From < 0 )
38+ throw new ArgumentException ( "--from cannot be negative" ) ;
39+ if ( To < 0 )
40+ throw new ArgumentException ( "--to cannot be negative" ) ;
41+ if ( To < From )
42+ throw new ArgumentException ( "--from cannot be greater than --to" ) ;
43+
3744 if ( PendingQueue == false && FailedQueue == false && InProgressQueue == false )
3845 throw new CommandFailedException ( "Must specify at least one queue to peek in. Use -h to see available options." ) ;
3946 var broker = Queue . Make ( UseSecondaryQueue ) ;
40- var from = Offset ;
41- var to = Offset + Limit - 1 ;
4247 if ( PendingQueue ) {
43- PrintMessages ( broker . PeekPendingMessages ( from , to ) , "Pending" ) ;
48+ PrintMessages ( broker . PeekPendingMessages ( From , To ) , "Pending" ) ;
4449 }
4550 if ( InProgressQueue ) {
46- PrintMessages ( broker . PeekInProgressMessages ( from , to ) , "In-progress" ) ;
51+ PrintMessages ( broker . PeekInProgressMessages ( From , To ) , "In-progress" ) ;
4752 }
4853 if ( FailedQueue ) {
49- PrintMessages ( broker . PeekFailedMessages ( from , to ) , "Failed" ) ;
54+ PrintMessages ( broker . PeekFailedMessages ( From , To ) , "Failed" ) ;
5055 }
5156 }
5257
0 commit comments