good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
Erigon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
a
Erigon
Commits
586198cc
Commit
586198cc
authored
7 years ago
by
Sorin Neacsu
Committed by
Felix Lange
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
console: add admin.clearHistory command (#15614)
parent
d95962cd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
console/console.go
+11
-0
11 additions, 0 deletions
console/console.go
console/console_test.go
+1
-0
1 addition, 0 deletions
console/console_test.go
console/prompter.go
+8
-0
8 additions, 0 deletions
console/prompter.go
with
20 additions
and
0 deletions
console/console.go
+
11
−
0
View file @
586198cc
...
...
@@ -192,6 +192,7 @@ func (c *Console) init(preload []string) error {
if
obj
:=
admin
.
Object
();
obj
!=
nil
{
// make sure the admin api is enabled over the interface
obj
.
Set
(
"sleepBlocks"
,
bridge
.
SleepBlocks
)
obj
.
Set
(
"sleep"
,
bridge
.
Sleep
)
obj
.
Set
(
"clearHistory"
,
c
.
clearHistory
)
}
// Preload any JavaScript files before starting the console
for
_
,
path
:=
range
preload
{
...
...
@@ -216,6 +217,16 @@ func (c *Console) init(preload []string) error {
return
nil
}
func
(
c
*
Console
)
clearHistory
()
{
c
.
history
=
nil
c
.
prompter
.
ClearHistory
()
if
err
:=
os
.
Remove
(
c
.
histPath
);
err
!=
nil
{
fmt
.
Fprintln
(
c
.
printer
,
"can't delete history file:"
,
err
)
}
else
{
fmt
.
Fprintln
(
c
.
printer
,
"history file deleted"
)
}
}
// consoleOutput is an override for the console.log and console.error methods to
// stream the output into the configured output stream instead of stdout.
func
(
c
*
Console
)
consoleOutput
(
call
otto
.
FunctionCall
)
otto
.
Value
{
...
...
This diff is collapsed.
Click to expand it.
console/console_test.go
+
1
−
0
View file @
586198cc
...
...
@@ -68,6 +68,7 @@ func (p *hookedPrompter) PromptConfirm(prompt string) (bool, error) {
}
func
(
p
*
hookedPrompter
)
SetHistory
(
history
[]
string
)
{}
func
(
p
*
hookedPrompter
)
AppendHistory
(
command
string
)
{}
func
(
p
*
hookedPrompter
)
ClearHistory
()
{}
func
(
p
*
hookedPrompter
)
SetWordCompleter
(
completer
WordCompleter
)
{}
// tester is a console test environment for the console tests to operate on.
...
...
This diff is collapsed.
Click to expand it.
console/prompter.go
+
8
−
0
View file @
586198cc
...
...
@@ -51,6 +51,9 @@ type UserPrompter interface {
// if and only if the prompt to append was a valid command.
AppendHistory
(
command
string
)
// ClearHistory clears the entire history
ClearHistory
()
// SetWordCompleter sets the completion function that the prompter will call to
// fetch completion candidates when the user presses tab.
SetWordCompleter
(
completer
WordCompleter
)
...
...
@@ -158,6 +161,11 @@ func (p *terminalPrompter) AppendHistory(command string) {
p
.
State
.
AppendHistory
(
command
)
}
// ClearHistory clears the entire history
func
(
p
*
terminalPrompter
)
ClearHistory
()
{
p
.
State
.
ClearHistory
()
}
// SetWordCompleter sets the completion function that the prompter will call to
// fetch completion candidates when the user presses tab.
func
(
p
*
terminalPrompter
)
SetWordCompleter
(
completer
WordCompleter
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment