Made history --help show history man page and history is now saved only once while deleting items
This commit is contained in:
parent
602109bd8d
commit
25f9105a97
@ -3614,6 +3614,7 @@ static int builtin_history( parser_t &parser, wchar_t **argv )
|
||||
{ L"contains", required_argument, 0, 'c' },
|
||||
{ L"save", no_argument, 0, 'v' },
|
||||
{ L"clear", no_argument, 0, 'l' },
|
||||
{ L"help", no_argument, 0, 'h' },
|
||||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
@ -3646,6 +3647,10 @@ static int builtin_history( parser_t &parser, wchar_t **argv )
|
||||
case 'l':
|
||||
clear_history = true;
|
||||
break;
|
||||
case 'h':
|
||||
builtin_print_help( parser, argv[0], stdout_buffer );
|
||||
return STATUS_BUILTIN_OK;
|
||||
break;
|
||||
case '?':
|
||||
append_format(stderr_buffer, BUILTIN_ERR_UNKNOWN, argv[0], argv[woptind-1]);
|
||||
return STATUS_BUILTIN_ERROR;
|
||||
|
@ -3,34 +3,34 @@
|
||||
\subsection history-synopsis Synopsis
|
||||
<pre>
|
||||
history (--save | --clear)
|
||||
history (--search | --delete ) (--prefix "prefix string" | --search "search string")
|
||||
history (--search | --delete ) (--prefix "prefix string" | --contains "search string")
|
||||
</pre>
|
||||
|
||||
\subsection history-description Description
|
||||
|
||||
history is used to list, search and delete user's command history.
|
||||
history is used to list, search and delete user's command history
|
||||
|
||||
\subsection history-examples Example
|
||||
|
||||
<pre>
|
||||
history --save
|
||||
Save all changes in history file.
|
||||
Save all changes in history file
|
||||
|
||||
history --clear
|
||||
Delete all history items.
|
||||
Delete all history items
|
||||
|
||||
history --search --contains "foo"
|
||||
Searches commands containing "foo" string.
|
||||
Searches commands containing "foo" string
|
||||
|
||||
history --search --prefix "foo"
|
||||
Searches for commands with prefix "foo".
|
||||
Searches for commands with prefix "foo"
|
||||
|
||||
history --delete --contains "foo"
|
||||
Interactively delete commands containing string "foo".
|
||||
Interactively delete commands containing string "foo"
|
||||
|
||||
history --delete --prefix "foo"
|
||||
Interactively delete commands with prefix "foo".
|
||||
Interactively delete commands with prefix "foo"
|
||||
|
||||
history --delete "foo"
|
||||
Delete command "foo" from history.
|
||||
Delete command "foo" from history
|
||||
</pre>
|
||||
|
@ -406,8 +406,6 @@ void history_t::remove(const wcstring &str)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
save();
|
||||
}
|
||||
|
||||
void history_t::get_string_representation(wcstring &result, const wcstring &separator)
|
||||
|
@ -54,6 +54,9 @@ function history --description "Deletes an item from history"
|
||||
set found_items (builtin history --search --contains $contains_args)
|
||||
case none
|
||||
builtin history $argv
|
||||
|
||||
#Save changes after deleting item
|
||||
builtin history --save
|
||||
return 0
|
||||
end
|
||||
|
||||
@ -101,8 +104,12 @@ function history --description "Deletes an item from history"
|
||||
else
|
||||
builtin history --delete $found_items[(math $i - 1)]
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
#Save changes after deleting item(s)
|
||||
builtin history --save
|
||||
end
|
||||
case save
|
||||
#Save changes to history file
|
||||
|
Loading…
x
Reference in New Issue
Block a user