Информативный вывод при вызове status
This commit is contained in:
		
							parent
							
								
									aa4260cdb9
								
							
						
					
					
						commit
						c388d01a2f
					
				
					 1 changed files with 21 additions and 3 deletions
				
			
		| 
						 | 
					@ -44,6 +44,22 @@ class Snag {
 | 
				
			||||||
		return result;
 | 
							return result;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						private string gitStatus(string shortStatus, bool formatted = false) {
 | 
				
			||||||
 | 
							immutable string[string] statusMap = [
 | 
				
			||||||
 | 
								"??": "Untracked",
 | 
				
			||||||
 | 
								"A": "Added",
 | 
				
			||||||
 | 
								"M": "Modified",
 | 
				
			||||||
 | 
								"D": "Deleted",
 | 
				
			||||||
 | 
								"R": "Renamed",
 | 
				
			||||||
 | 
								"C": "Copied",
 | 
				
			||||||
 | 
								"U": "Unmerged",
 | 
				
			||||||
 | 
								"T": "Type changed",
 | 
				
			||||||
 | 
								"!": "Ignored"
 | 
				
			||||||
 | 
							];
 | 
				
			||||||
 | 
							string fullStatus = statusMap.get(shortStatus, shortStatus);
 | 
				
			||||||
 | 
							return formatted && fullStatus.length < 8 ? fullStatus ~ "\t" : fullStatus;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void initialize(bool force) {
 | 
						void initialize(bool force) {
 | 
				
			||||||
		auto result = execute(_baseCommand ~ ["rev-parse", "--git-dir"]);
 | 
							auto result = execute(_baseCommand ~ ["rev-parse", "--git-dir"]);
 | 
				
			||||||
		!force && !result.status &&
 | 
							!force && !result.status &&
 | 
				
			||||||
| 
						 | 
					@ -84,9 +100,11 @@ class Snag {
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		writeln("The following list of files requires backup:");
 | 
							writeln("The following list of files requires backup:");
 | 
				
			||||||
		result.output.split('\n').filter!(e => !e.strip.empty).each!((e) {
 | 
							result.output.split('\n')[0..$-1].map!(e =>
 | 
				
			||||||
			writefln("\t/%s", e.strip.split[1]);
 | 
								e.strip.split
 | 
				
			||||||
		});
 | 
							).each!(e =>
 | 
				
			||||||
 | 
								writefln("\t%s\t/%s", gitStatus(e[0], true), e[1])
 | 
				
			||||||
 | 
							);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void create(string comment, string author, string email) {
 | 
						void create(string comment, string author, string email) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue