feat: flush [-noprompt], option support
This commit is contained in:
parent
cfdd50aa63
commit
b694827bcb
|
|
@ -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" : "");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ last saved version.
|
|||
|
||||
<H3>Usage:</H3>
|
||||
<BLOCKQUOTE>
|
||||
<B>flush</B> [<I>cellname</I>] [<B>-dereference</B>]<BR><BR>
|
||||
<B>flush</B> [<I>cellname</I>] [<B>-noprompt</B>] [<B>-dereference</B>]<BR><BR>
|
||||
<BLOCKQUOTE>
|
||||
where <I>cellname</I> is the name of a cell definition to be
|
||||
flushed.
|
||||
|
|
@ -43,6 +43,10 @@ last saved version.
|
|||
The effects of the <B>flush</B> command are irrevocable; the
|
||||
command cannot be undone with an <B>undo</B> command. <P>
|
||||
|
||||
With the <B>-noprompt</B> option, no interactive confirmation is
|
||||
presented if there are unsaved changes. Those changes will be
|
||||
flushed.
|
||||
|
||||
With the <B>-dereference</B> 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
|
||||
|
|
|
|||
Loading…
Reference in New Issue