0.0.3
This commit is contained in:
		
							parent
							
								
									66d64a9642
								
							
						
					
					
						commit
						7714bc498e
					
				
					 2 changed files with 22 additions and 3 deletions
				
			
		
							
								
								
									
										23
									
								
								source/app.d
									
										
									
									
									
								
							
							
						
						
									
										23
									
								
								source/app.d
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -2,8 +2,6 @@ import snapd;
 | 
			
		|||
import commandr;
 | 
			
		||||
import std.file;
 | 
			
		||||
 | 
			
		||||
import std.stdio : writeln;
 | 
			
		||||
 | 
			
		||||
import core.stdc.stdlib : EXIT_SUCCESS, EXIT_FAILURE;
 | 
			
		||||
 | 
			
		||||
private string programName = "snapd";
 | 
			
		||||
| 
						 | 
				
			
			@ -11,6 +9,9 @@ private string programName = "snapd";
 | 
			
		|||
int main(string[] args)
 | 
			
		||||
{
 | 
			
		||||
	auto argumets = new Program(programName, snapdVersion)
 | 
			
		||||
		.add(new Command("init", "Initializing the repository for storing snapshots"))
 | 
			
		||||
		.add(new Command("status", "Checking the status of tracked files"))
 | 
			
		||||
		.add(new Command("create", "Create a new backup"))
 | 
			
		||||
		.add(new Option("c", "config", "Сonfiguration file path")
 | 
			
		||||
			.optional
 | 
			
		||||
			.validateEachWith(
 | 
			
		||||
| 
						 | 
				
			
			@ -31,5 +32,23 @@ int main(string[] args)
 | 
			
		|||
		return EXIT_FAILURE;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	auto snapd = new Snapd(config);
 | 
			
		||||
 | 
			
		||||
	try {
 | 
			
		||||
		argumets
 | 
			
		||||
			.on("init", (init) {
 | 
			
		||||
				snapd.initialize();
 | 
			
		||||
			})
 | 
			
		||||
			.on("status", (status) {
 | 
			
		||||
				snapd.status();
 | 
			
		||||
			})
 | 
			
		||||
			.on("create", (create) {
 | 
			
		||||
				snapd.create();
 | 
			
		||||
			});
 | 
			
		||||
	} catch (SnapdException e) {
 | 
			
		||||
		e.print();
 | 
			
		||||
		return EXIT_FAILURE;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return EXIT_SUCCESS;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,3 +1,3 @@
 | 
			
		|||
module snapd.version_;
 | 
			
		||||
 | 
			
		||||
enum snapdVersion = "0.0.2";
 | 
			
		||||
enum snapdVersion = "0.0.3";
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue