diff --git a/lib/cli/commands/query_word.dart b/lib/cli/commands/query_word.dart index 45219da..09853f4 100644 --- a/lib/cli/commands/query_word.dart +++ b/lib/cli/commands/query_word.dart @@ -22,6 +22,19 @@ class QueryWord extends Command { abbr: 'j', help: 'Output results in JSON format', ); + + argParser.addOption( + 'page', + abbr: 'p', + valueHelp: 'NUM', + defaultsTo: '1', + ); + + argParser.addOption( + 'pageSize', + valueHelp: 'NUM', + defaultsTo: '30', + ); } Future run() async { @@ -59,6 +72,8 @@ class QueryWord extends Command { db, searchWord, argResults!.flag('json'), + int.parse(argResults!.option('page')!), + int.parse(argResults!.option('pageSize')!), ); } } @@ -89,13 +104,19 @@ class QueryWord extends Command { DatabaseExecutor db, String searchWord, bool jsonOutput, + int page, + int pageSize, ) async { final time = Stopwatch()..start(); final count = await JaDBConnection(db).jadbSearchWordCount(searchWord); time.stop(); final time2 = Stopwatch()..start(); - final result = await JaDBConnection(db).jadbSearchWord(searchWord); + final result = await JaDBConnection(db).jadbSearchWord( + searchWord, + page: page, + pageSize: pageSize, + ); time2.stop(); if (result == null) {