list command current state
这个提交包含在:
		
							
								
								
									
										35
									
								
								cli/commandlist.cpp
									
									
									
									
									
										普通文件
									
								
							
							
						
						
									
										35
									
								
								cli/commandlist.cpp
									
									
									
									
									
										普通文件
									
								
							| @@ -0,0 +1,35 @@ | |||||||
|  | #include <QCommandLineParser> | ||||||
|  | #include "commandlist.h" | ||||||
|  | #include "databasefactory.h" | ||||||
|  | #include "logger.h" | ||||||
|  |  | ||||||
|  | int CommandList::handle(QStringList arguments) | ||||||
|  | { | ||||||
|  |     QCommandLineParser parser; | ||||||
|  |     parser.addOptions({ | ||||||
|  |                           { { "r", "reverse" }, "Print most-recent changed files first" }, | ||||||
|  |                           { { "c", "count"}, "Counts the number of paths listed"}, | ||||||
|  |                           { "pattern", "Only list files from index matching the pattern, e. g. */.git/*", "pattern" }, | ||||||
|  |                       }); | ||||||
|  |  | ||||||
|  |     parser.addHelpOption(); | ||||||
|  |     parser.addPositionalArgument("list", "Lists paths in the index", "list [options]"); | ||||||
|  |  | ||||||
|  |     parser.process(arguments); | ||||||
|  |     bool reverse = parser.isSet("reverse"); | ||||||
|  |     if(reverse) | ||||||
|  |     { | ||||||
|  |         throw QSSGeneralException("Reverse option to be implemented"); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     QStringList files = parser.positionalArguments(); | ||||||
|  |     QString queryStrings = files.join(' '); | ||||||
|  |     auto results = dbService->search(QSSQuery::build(queryStrings)); | ||||||
|  |  | ||||||
|  |     for(SearchResult &result : results) | ||||||
|  |     { | ||||||
|  |         Logger::info() << result.fileData.absPath << endl; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  | } | ||||||
							
								
								
									
										15
									
								
								cli/commandlist.h
									
									
									
									
									
										普通文件
									
								
							
							
						
						
									
										15
									
								
								cli/commandlist.h
									
									
									
									
									
										普通文件
									
								
							| @@ -0,0 +1,15 @@ | |||||||
|  | #ifndef COMMANDSEARCH_H | ||||||
|  | #define COMMANDSEARCH_H | ||||||
|  | #include "command.h" | ||||||
|  | #include "../shared/sqlitesearch.h" | ||||||
|  |  | ||||||
|  | class CommandList : public Command | ||||||
|  | { | ||||||
|  | public: | ||||||
|  |     using Command::Command; | ||||||
|  |  | ||||||
|  |     int handle(QStringList arguments) override; | ||||||
|  |  | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | #endif // COMMANDSEARCH_H | ||||||
		在新工单中引用
	
	屏蔽一个用户