Added quiet option. I think I'm done here.
This commit is contained in:
parent
9183961738
commit
f528eaeb83
2 changed files with 30 additions and 14 deletions
37
main.c
37
main.c
|
|
@ -48,13 +48,15 @@ bool print_with_color = false;
|
|||
|
||||
bool force_rebuild = false;
|
||||
|
||||
bool quiet = false;
|
||||
|
||||
static void parse_args(int argc, char* const* argv)
|
||||
{
|
||||
bool unset_operators = true;
|
||||
|
||||
print_with_color = isatty(1);
|
||||
|
||||
for (int opt; (opt = getopt(argc, argv, "pyvc:eEo:C:B")) != -1; ) switch (opt)
|
||||
for (int opt; (opt = getopt(argc, argv, "pyqvc:eEo:C:B")) != -1; ) switch (opt)
|
||||
{
|
||||
case 'p':
|
||||
print_all_and_quit = true;
|
||||
|
|
@ -64,6 +66,10 @@ static void parse_args(int argc, char* const* argv)
|
|||
assume_yes = true;
|
||||
break;
|
||||
|
||||
case 'q':
|
||||
quiet = true;
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
verbose = true;
|
||||
break;
|
||||
|
|
@ -119,13 +125,13 @@ static void parse_args(int argc, char* const* argv)
|
|||
use_operators.xor = true;
|
||||
else if (!strcmp(moving, "nxor") || !strcmp(moving, "=="))
|
||||
use_operators.nxor = true;
|
||||
else if (!strcmp(moving, "<"))
|
||||
else if (!strcmp(moving, "lt") || !strcmp(moving, "<"))
|
||||
use_operators.lt = true;
|
||||
else if (!strcmp(moving, "<="))
|
||||
else if (!strcmp(moving, "lte") || !strcmp(moving, "<="))
|
||||
use_operators.lte = true;
|
||||
else if (!strcmp(moving, ">"))
|
||||
else if (!strcmp(moving, "gt") || !strcmp(moving, ">"))
|
||||
use_operators.gt = true;
|
||||
else if (!strcmp(moving, ">="))
|
||||
else if (!strcmp(moving, "gte") || !strcmp(moving, ">="))
|
||||
use_operators.gte = true;
|
||||
else if (!strcmp(moving, "ternary") || !strcmp(moving, "?:"))
|
||||
use_operators.ternary = true;
|
||||
|
|
@ -877,22 +883,25 @@ void get_simplifications(void)
|
|||
}
|
||||
else if (fd < 0 && errno == ENOENT)
|
||||
{
|
||||
puts(""
|
||||
"Oh! looks like you're running this for the first time" "\n"
|
||||
"I'll have to build up my cache of simplifications" "\n"
|
||||
"I'll only have to do this once." "\n"
|
||||
"\n"
|
||||
"This may take a while." "\n"
|
||||
"");
|
||||
if (!quiet)
|
||||
{
|
||||
puts(""
|
||||
"Oh! looks like you're running this for the first time" "\n"
|
||||
"I'll have to build up my cache of simplifications" "\n"
|
||||
"I'll only have to do this once." "\n"
|
||||
"\n"
|
||||
"This may take a while." "\n"
|
||||
"");
|
||||
}
|
||||
|
||||
rebuild: {};
|
||||
|
||||
if (!verbose)
|
||||
if (!quiet && !verbose)
|
||||
{
|
||||
puts("re-run with '-v' to watch progress");
|
||||
}
|
||||
|
||||
if (!assume_yes)
|
||||
if (!quiet && !assume_yes)
|
||||
{
|
||||
puts("");
|
||||
puts("any input to start:"), getchar();
|
||||
|
|
|
|||
7
makefile
7
makefile
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
# vim: noexpandtab tabstop=4 :
|
||||
|
||||
PREFIX ?= ${HOME}
|
||||
|
||||
args =
|
||||
|
||||
cc = gcc
|
||||
|
|
@ -22,6 +24,11 @@ ldflags += -lreadline
|
|||
run: /tmp/4-variable-simplifier
|
||||
$< $(args)
|
||||
|
||||
install: ${PREFIX}/bin/4-variable-simplifier
|
||||
|
||||
${PREFIX}/bin/4-variable-simplifier: /tmp/4-variable-simplifier
|
||||
mkdir -pv ${PREFIX}/bin/
|
||||
cp -vau $< $@
|
||||
|
||||
# nix --extra-experimental-features nix-command --extra-experimental-features flakes develop --command 'make'
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue