diff --git a/commands/CmdFI.c b/commands/CmdFI.c index b958ef00..4b6b9cb8 100644 --- a/commands/CmdFI.c +++ b/commands/CmdFI.c @@ -945,6 +945,7 @@ CmdFlush( static const char * const actionNames[] = { "no", "yes", 0 }; char *prompt; bool dereference = FALSE; + bool noprompt = FALSE; /* no interactive confirm when changed */ if (!strncmp(cmd->tx_argv[cmd->tx_argc - 1], "-deref", 6)) { @@ -952,9 +953,15 @@ CmdFlush( cmd->tx_argc--; } + if (!strcmp(cmd->tx_argv[cmd->tx_argc - 1], "-noprompt")) + { + noprompt = TRUE; + cmd->tx_argc--; + } + if (cmd->tx_argc > 2) { - TxError("Usage: flush [cellname] [dereference]\n"); + TxError("Usage: flush [cellname] [-noprompt] [-dereference]\n"); return; } @@ -975,7 +982,9 @@ CmdFlush( } } - if (def->cd_flags & (CDMODIFIED|CDSTAMPSCHANGED|CDBOXESCHANGED)) + bool has_changes = (def->cd_flags & (CDMODIFIED|CDSTAMPSCHANGED|CDBOXESCHANGED)) != 0; + + if (!noprompt && has_changes) { prompt = TxPrintString("Really throw away all changes made" " to cell %s? ", def->cd_name); @@ -986,7 +995,7 @@ CmdFlush( cmdFlushCell(def, dereference); SelectClear(); - TxPrintf("[Flushed]\n"); + TxPrintf("[Flushed%s]\n", has_changes ? " Modifications were Discarded" : ""); } diff --git a/doc/html/flush.html b/doc/html/flush.html index 6ee7be30..8ae2b68f 100644 --- a/doc/html/flush.html +++ b/doc/html/flush.html @@ -26,7 +26,7 @@ last saved version.

Usage:

- flush [cellname] [-dereference]

+ flush [cellname] [-noprompt] [-dereference]

where cellname is the name of a cell definition to be flushed. @@ -43,6 +43,10 @@ last saved version. The effects of the flush command are irrevocable; the command cannot be undone with an undo command.

+ With the -noprompt option, no interactive confirmation is + presented if there are unsaved changes. Those changes will be + flushed. + With the -dereference option, any file path that has been associated with the cell is discarded, and the cell is reloaded from the first location found in the search path. With search