mirror of https://github.com/PatrickLipka/tt.git
				
				
				
			version command added
This commit is contained in:
		
							parent
							
								
									d09c657d91
								
							
						
					
					
						commit
						ae5319c58c
					
				|  | @ -94,7 +94,7 @@ Switched to task HPCE/test | ||||||
| ~~~ | ~~~ | ||||||
| 
 | 
 | ||||||
| #### `rm [<Project Name>/]<Task Name> | <Project Name>` | #### `rm [<Project Name>/]<Task Name> | <Project Name>` | ||||||
| Deletes all data of a project or task. \  | Deletes all data of a project or task.\  | ||||||
| If only a project name is provided, the project with all tasks is beeing deleted. The previous project in the project list is set active\ | If only a project name is provided, the project with all tasks is beeing deleted. The previous project in the project list is set active\ | ||||||
| If only a task name is provided, this task is beeing deleted from the active project if present. The previous task in the task list is set active.\ | If only a task name is provided, this task is beeing deleted from the active project if present. The previous task in the task list is set active.\ | ||||||
| If `<Project Name>/<Task Name>` is provided, the task with name `<Task Name>` is deleted from project `<Project Name>` if both are present. | If `<Project Name>/<Task Name>` is provided, the task with name `<Task Name>` is deleted from project `<Project Name>` if both are present. | ||||||
|  | @ -250,3 +250,6 @@ Project: Code Project | ||||||
| --- Debugging: 9.26 | --- Debugging: 9.26 | ||||||
| Total: 24.35 | Total: 24.35 | ||||||
| ~~~ | ~~~ | ||||||
|  | 
 | ||||||
|  | ### `version` | ||||||
|  | Prints the version number of `tt` | ||||||
|  |  | ||||||
							
								
								
									
										2
									
								
								src/tt.h
								
								
								
								
							
							
						
						
									
										2
									
								
								src/tt.h
								
								
								
								
							|  | @ -3,6 +3,8 @@ | ||||||
| 
 | 
 | ||||||
| #include <string> | #include <string> | ||||||
| 
 | 
 | ||||||
|  | #define TT_VERSION 1.0 | ||||||
|  | 
 | ||||||
| // global variables:
 | // global variables:
 | ||||||
| extern std::string user_name; | extern std::string user_name; | ||||||
| extern std::string tracking_dir; | extern std::string tracking_dir; | ||||||
|  |  | ||||||
							
								
								
									
										12
									
								
								src/ui.cpp
								
								
								
								
							
							
						
						
									
										12
									
								
								src/ui.cpp
								
								
								
								
							|  | @ -28,7 +28,8 @@ std::string command_names[num_commands]={ | ||||||
|     "report", |     "report", | ||||||
|     "ls", |     "ls", | ||||||
|     "start", |     "start", | ||||||
|     "save" |     "save", | ||||||
|  |     "version" | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| std::vector<std::string> autocomplete_names; // global variable
 | std::vector<std::string> autocomplete_names; // global variable
 | ||||||
|  | @ -173,6 +174,8 @@ void parse_input(std::string input, ProjectList *proj_list){ | ||||||
|         } |         } | ||||||
|     }else if (command == "save"){ |     }else if (command == "save"){ | ||||||
|         command_save(proj_list); |         command_save(proj_list); | ||||||
|  |     }else if (command == "version"){ | ||||||
|  |         command_version(); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -612,3 +615,10 @@ void command_save(ProjectList *proj_list){ | ||||||
|     proj_list->save(file_name); |     proj_list->save(file_name); | ||||||
|     std::cout << "Tracking data saved to file " << file_name << std::endl; |     std::cout << "Tracking data saved to file " << file_name << std::endl; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | // print version number
 | ||||||
|  | void command_version(){ | ||||||
|  |     std::cout << "tt v." << STRING(TT_VERSION) << std::endl; | ||||||
|  |     std::cout << "Author: Patrick Lipka (patrick.lipka@emea.nec.com)" << std::endl; | ||||||
|  |     std::cout << "tt is free software published under the BSD-2-Clause licence (see. https://opensource.org/licenses/BSD-2-Clause)" << std::endl; | ||||||
|  | } | ||||||
|  |  | ||||||
							
								
								
									
										3
									
								
								src/ui.h
								
								
								
								
							
							
						
						
									
										3
									
								
								src/ui.h
								
								
								
								
							|  | @ -5,7 +5,7 @@ | ||||||
| #include <string> | #include <string> | ||||||
| #include "project.h" | #include "project.h" | ||||||
| 
 | 
 | ||||||
| const int num_commands=12; | const int num_commands=13; | ||||||
| extern std::string command_names[num_commands]; | extern std::string command_names[num_commands]; | ||||||
| extern std::vector<std::string> autocomplete_names; | extern std::vector<std::string> autocomplete_names; | ||||||
| char **tt_name_completion(const char* text, int start, int end); | char **tt_name_completion(const char* text, int start, int end); | ||||||
|  | @ -30,4 +30,5 @@ void command_at(std::string input, int wtime, ProjectList *proj_list); | ||||||
| void command_rt(std::string input, int wtime, ProjectList *proj_list); | void command_rt(std::string input, int wtime, ProjectList *proj_list); | ||||||
| void command_report(std::string date_str, ProjectList *proj_list); | void command_report(std::string date_str, ProjectList *proj_list); | ||||||
| void command_save(ProjectList *proj_list); | void command_save(ProjectList *proj_list); | ||||||
|  | void command_version(); | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue