Skip to content

Commit

Permalink
Merge pull request #17 from ninedotnine/danso/log-program-name
Browse files Browse the repository at this point in the history
Prepend program name to prompts, help text
  • Loading branch information
rushsteve1 committed May 24, 2022
2 parents 70a0207 + 7547703 commit adcc5a0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion source/trash/opts.d
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ int parseOpts(ref string[] args) {
// This includes when no arguments are given
if (helpInfo.helpWanted || arglen < 2) {
// trash-d changes the formatting of the help text to be much nicer
string text = "Usage: \033[1mtrash [OPTIONS...] [FILES...]\033[0m\n";
string text = "Usage: \033[1m"
~ OPTS.prog_name
~ " [OPTIONS...] [FILES...]\033[0m\n";
OutBuffer buf = new OutBuffer();
defaultGetoptFormatter(buf, text, helpInfo.options, "\t%*s %*s\t%*s%s\x0a");
writefln("%s\n\n%s\n%s", VER_TEXT, buf, COPY_TEXT);
Expand Down
2 changes: 1 addition & 1 deletion source/trash/util.d
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ int ferr(Char, A...)(in Char[] fmt, A args) {
Prompts the user for a yes or no input, defaulting to no.
*/
bool prompt(Char, A...)(in Char[] fmt, A args) {
writef("Are you sure you want to %s? [y/N] ", format(fmt, args));
writef(OPTS.prog_name ~ " : Are you sure you want to %s? [y/N] ", format(fmt, args));
string input = stdin.readln().strip().toLower();
return input == "y" || input == "yes";
}
Expand Down

0 comments on commit adcc5a0

Please sign in to comment.