aboutsummaryrefslogtreecommitdiffstats
path: root/blockpool/config_test.go
Commit message (Expand)AuthorAgeFilesLines
* improve documentation and move one testzelig2015-03-201-1/+3
* use own total difficulty to limit best peerzelig2015-03-201-2/+3
* peer suspension to disallow reconnect after disconnect on fatal error for se...zelig2015-03-201-1/+3
* partial fix to idle best peer issuezelig2015-03-041-1/+3
* major rewrite, reorg of blockpool + new featureszelig2015-02-251-0/+40
eea43683fee58e26a48a51145e72d3ae7ad8'>root/cmd/utils/cmd.go
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-05-19 01:24:30 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-05-19 01:24:30 +0800
commitf14feea43683fee58e26a48a51145e72d3ae7ad8 (patch)
tree6f02793925e5917780a63024490dbc6f5a641f72 /cmd/utils/cmd.go
parent36a4ba32485fb6605ea23f03896ae8d7c4cc44ae (diff)
downloadgo-tangerine-f14feea43683fee58e26a48a51145e72d3ae7ad8.tar.gz
go-tangerine-f14feea43683fee58e26a48a51145e72d3ae7ad8.tar.zst
go-tangerine-f14feea43683fee58e26a48a51145e72d3ae7ad8.zip
Refactor user prompts into utils
Diffstat (limited to 'cmd/utils/cmd.go')
-rw-r--r--cmd/utils/cmd.go44
1 files changed, 44 insertions, 0 deletions
diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go
index fb55a64af..62d350066 100644
--- a/cmd/utils/cmd.go
+++ b/cmd/utils/cmd.go
@@ -22,11 +22,13 @@
package utils
import (
+ "bufio"
"fmt"
"io"
"os"
"os/signal"
"regexp"
+ "strings"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
@@ -35,6 +37,7 @@ import (
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/logger/glog"
"github.com/ethereum/go-ethereum/rlp"
+ "github.com/peterh/liner"
)
var interruptCallbacks = []func(os.Signal){}
@@ -85,6 +88,47 @@ func confirm(message string) bool {
return r == "y"
}
+func PromptConfirm(prompt string) (bool, error) {
+ var (
+ input string
+ err error
+ )
+ prompt = prompt + " [y/N] "
+
+ if liner.TerminalSupported() {
+ lr := liner.NewLiner()
+ defer lr.Close()
+ input, err = lr.Prompt(prompt)
+ } else {
+ fmt.Print(prompt)
+ input, err = bufio.NewReader(os.Stdin).ReadString('\n')
+ fmt.Println()
+ }
+
+ if len(input) > 0 && strings.ToUpper(input[:1]) == "Y" {
+ return true, nil
+ } else {
+ return false, nil
+ }
+
+ return false, err
+}
+
+func PromptPassword(prompt string, warnTerm bool) (string, error) {
+ if liner.TerminalSupported() {
+ lr := liner.NewLiner()
+ defer lr.Close()
+ return lr.PasswordPrompt(prompt)
+ }
+ if warnTerm {
+ fmt.Println("!! Unsupported terminal, password will be echoed.")
+ }
+ fmt.Print(prompt)
+ input, err := bufio.NewReader(os.Stdin).ReadString('\n')
+ fmt.Println()
+ return input, err
+}
+
func initDataDir(Datadir string) {
_, err := os.Stat(Datadir)
if err != nil {
|\ | * Coding style and whitespace cleanup.Matthew Barnes2010-05-251-3/+2 | * Handle adding 'X' close button on the menu bar. Restore adding the sameSrinivasa Ragavan2010-05-111-0/+30 | * set widget name for the MeeGo theme on the search toolbar tooMichael Meeks2010-05-071-0/+2 | * add a close-window action that doesn't become insensitive on the last window.Michael Meeks2010-04-151-17/+0 | * add stock close buttonMichael Meeks2010-04-151-0/+17 | * Detect MeeGo, and propagate settings variously.Michael Meeks2010-04-121-1/+28 | * Simplify the search UI for express mode.Matthew Barnes2010-04-071-7/+18 | * Move "section" documentation out of header files.Matthew Barnes2010-04-071-0/+6 | * Make EShell and related classes extensible.Matthew Barnes2010-04-071-32/+11 * | Bug #325121 - Do not translate developer strings in g_param_spec_*Milan Crha2010-04-021-21/+21 * | Simplify the search UI for express mode.Matthew Barnes2010-03-271-7/+18 * | Move "section" documentation out of header files.Matthew Barnes2010-03-221-0/+6 * | Make EShell and related classes extensible.Matthew Barnes2010-03-201-32/+11 |/ * Fix a couple compiler warnings.Matthew Barnes2010-03-161-2/+1 * Shell and UI manager cleanups.Matthew Barnes2010-03-141-13/+2 * make the 'New' drop-down menu much cleaner for express modeMichael Meeks2010-03-141-0/+12 * Add a set of actions that open a view in a new windowMichael Meeks2010-03-141-1/+1 * Implement account-wide search scope in mail.Matthew Barnes2010-02-071-3/+0 * Add a EShellWindow::shell-view-created signal.Matthew Barnes2010-01-231-5/+65 * Introduce ESelectable and EFocusTracker.Matthew Barnes2009-12-261-0/+40 * Add private virtual methods to EShellWindowClass.Matthew Barnes2009-12-021-86/+571 * Add a --geometry command-line option.Matthew Barnes2009-11-261-2/+37 * Get the "save-calendar" plugin working.Matthew Barnes2009-09-041-0/+7 * Introduce an EShellView::execute-search signal.Matthew Barnes2009-09-031-0/+3 * Kill EMMenu and EMPopup.Matthew Barnes2009-08-101-11/+0 * Add a "quit-requested" signal to the shutdown protocol.Matthew Barnes2009-07-131-2/+1 * Get the "startup-wizard" plugin working again.Matthew Barnes2009-06-301-2/+0 * Merge branch 'master' into kill-bonoboMatthew Barnes2009-05-271-1/+1 |\ | * Remove trailing whitespace, again.Matthew Barnes2009-05-271-4/+4 | * Fix several types of pedantic compiler warnings.Matthew Barnes2009-05-171-1/+1 | * ** BUGFIX: 573830 - g_timeout_add_seconds should be preferred to g_timeout_addMarcel Stimberg2009-05-041-1/+1 | * Bug 580893 – Kill libgnome/gnome-gconfMatthew Barnes2009-05-011-1/+0 | * Bug 577929 – Consolidate marshallersMatthew Barnes2009-04-231-1/+0 | * ** Fixes bug #572962Matthew Barnes2009-02-251-6/+4 | * Jeff Cai ** Fix for bug #563077 (Don't pass NULL to gtk_icon_info_get_filenam...Suman Manjunath2008-12-081-1/+1 | * Matthew Barnes <mbarnes@redhat.com> ** Fix for bug #548469 (Drop support for...Suman Manjunath2008-10-171-15/+10 | * Change License from GPL to LGPL.Sankarasivasubramanian Pasupathilingam2008-10-031-13/+13 | * Coding style cleanups.Matthew Barnes2008-08-191-2/+2 | * ** Fixes bug #508732Matthew Barnes2008-08-181-1/+5 | * ** Fixes bug #467115Matthew Barnes2008-08-071-9/+14 | * ** Fixes bug #542587Matthew Barnes2008-07-211-49/+25 * | Fix bugs caused by EShellBackend changes.Matthew Barnes2009-05-101-4/+3 * | Convert EShellModule to EShellBackendMatthew Barnes2009-05-071-62/+43 * | Add e_lookup_action() and e_lookup_action_group() to e-util, soMatthew Barnes2009-03-101-33/+2 * | Cleaning up the attachment bar, centralizing its popup menu, and convertingMatthew Barnes2009-03-091-0/+1 * | Make filter options for mail labels work again.Matthew Barnes2009-02-231-0/+7 * | Documentation tweaks.Matthew Barnes2009-02-191-3/+2 * | Rename EShell:online-mode to EShell:online and update docs.Matthew Barnes2009-02-191-34/+1 * | Disable Send/Receive when working offline.Matthew Barnes2009-02-131-0/+3 * | When invoking Evolution with URIs on the command-line (e.g. mailto:),Matthew Barnes2009-01-291-7/+12 * | Add unique-1.0 requirement (blessed external dependency).Matthew Barnes2009-01-291-2/+7 * | Make action group management in shell windows more elegant.Matthew Barnes2009-01-271-2/+31 * | Redesign EPluginUI to accommodate merging and unmerging shell views.Matthew Barnes2009-01-241-2/+4 * | Continue chipping away at EMFolderView and EMFolderBrowser.Matthew Barnes2009-01-111-2/+2 * | Tweak the EShell API.Matthew Barnes2009-01-081-1/+41 * | Solve a translation issue related to the New menu.Matthew Barnes2008-12-281-4/+34 * | Define a new interface called EMailReader, which implements operationsMatthew Barnes2008-12-271-1/+23 * | Add popup menus to the calendar memopad and taskpad.Matthew Barnes2008-10-311-1/+0 * | Get the calendar's memopad and taskpad working.Matthew Barnes2008-10-301-1/+8 * | Fix a couple minor UI bugs.Matthew Barnes2008-10-281-0/+10 * | Merge revisions 36534:36684 from trunk.Matthew Barnes2008-10-251-1/+0 * | Get the mail folder tree compiling, though I'm not yet sure why it's notMatthew Barnes2008-10-171-3/+35 * | Progress update:Matthew Barnes2008-10-141-0/+7 * | Finally fix the stupid shell view bootstrapping issue.Matthew Barnes2008-10-041-9/+3 * | Tasks is working. Still need to deal with some loose ends and test it all.Matthew Barnes2008-10-041-7/+10 * | Tasks progress. Merge EMemoPreview back into ECalComponentPreview.Matthew Barnes2008-10-031-4/+4 * | Update the headers on files I've created or completely rewritten to matchMatthew Barnes2008-10-021-11/+12 * | Get Memos to come up. Doesn't really work yet, but the widgets are all there.Matthew Barnes2008-09-301-32/+0 * | Saving progress. Experimenting with directory layout.Matthew Barnes2008-09-251-20/+20 * | Finally got the "Current View" menu under control.Matthew Barnes2008-09-191-1/+1 * | Progress update:Matthew Barnes2008-09-181-0/+32 * | Massive address book refactoring. Things are mostly working again.Matthew Barnes2008-09-171-45/+33 * | Begin documenting the new shell design.Matthew Barnes2008-09-151-8/+198 * | Allow EShellContent, EShellSidebar, and EShellTaskbar to be subclassed,Matthew Barnes2008-09-131-3/+3 * | Arrange for an ESourceList to be shared amongst all instances of a type ofMatthew Barnes2008-09-121-1/+0 * | Fix some bootstrapping issues.Matthew Barnes2008-09-101-60/+38 * | Fix some bugs in the way the shell widgets get initialized.Matthew Barnes2008-09-091-2/+3 * | Progress update:Matthew Barnes2008-09-091-6/+5 * | Progress update:Matthew Barnes2008-09-071-0/+26 * | Saving progress. Lots of changes. Things are a bit broken at the moment.Matthew Barnes2008-09-051-66/+21 * | Progress update:Matthew Barnes2008-08-301-13/+61 * | Progress update:Matthew Barnes2008-08-271-10/+68 * | Progress update:Matthew Barnes2008-08-271-1/+51 * | Progress update:Matthew Barnes2008-08-241-17/+59 * | Progress update:Matthew Barnes2008-08-231-3/+45 * | Committing the day's progress.Matthew Barnes2008-08-191-26/+154 * | Merge revisions 35993:36015 from trunk.Matthew Barnes2008-08-191-194/+65 * | Kill e-shell-marshal.list (unused).Matthew Barnes2008-08-101-1/+0 * | Treat the Preferences window as a singleton.Matthew Barnes2008-08-091-1/+0 * | Fix some compilation errors.Matthew Barnes2008-08-081-0/+6 * | Merge revisions 35747:35930 from trunk.Matthew Barnes2008-08-081-2/+2 * | Commit progress, which breaks everything.Matthew Barnes2008-08-081-147/+7 * | Disable all components and plugins. Begin rewriting the shell.Matthew Barnes2008-07-171-964/+205 |/ * ** Fix for bug #542889Paolo Borelli2008-07-141-10/+1 * updated novell copyright notices (left others alone)Jeffrey Stedfast2008-06-211-1/+1 * ** Allow evolution to build with G_DISABLE_SINGLE_INCLUDES andMatthew Barnes2008-06-061-9/+1 * ** Fix for bug #525238Ondrej Jirman2008-04-071-0/+10 * Make the status bar height as large as the task bar to eliminateMatthew Barnes2008-01-211-0/+7 * ** Fix for bug #329712Srinivasa Ragavan2008-01-181-1/+4 * From shell/ChangeLogChangwoo Ryu2008-01-111-1/+3 * ** Fix for bug #400213Milan Crha2007-11-301-45/+11 * ** Remove trailing whitespace from source code.Matthew Barnes2007-11-151-13/+13 * ** Fixes bug #492058Damien Carbery2007-11-031-19/+19 * Warning fixes: - NULL vs 0 vs FALSE - ANSIfication of declarations - guintKjartan Maraas2007-10-261-1/+1 * ** Fix for bug #329823Milan Crha2007-10-111-0/+33 * ** Fixes bug #437579Matthew Barnes2007-10-101-3/+6 * Fix for bug #461195 from Hiroyuki Ikezoe.Matthew Barnes2007-09-281-1/+1 * ** Fix for bug #471791 (Move away from asserts to g_ret*)Srinivasa Ragavan2007-09-031-8/+7 * Update FSF address in header comments (#469886). Patch from TobiasMatthew Barnes2007-09-021-2/+2 * Plugged memory leaks.Hiroyuki Ikezoe2007-07-261-1/+4 * ** Fix for bug #386503 from Matthew BarnesSrinivasa Ragavan2007-06-031-1/+1 * Fix for bug #259606Srinivasa Ragavan2007-04-201-14/+38 * Fix "incompatible pointer type" warnings (#360619).Matthew Barnes2007-03-301-1/+1 * ** Fixes bug #419524Matthew Barnes2007-03-211-1/+1 * Fixes #360815Chenthill Palanisamy2006-10-161-0/+1 * ** Fix for bug #334966Srinivasa Ragavan2006-10-141-1/+8 * ** Fix for bug #343331Srinivasa Ragavan2006-09-281-1/+11 * ** Fixes #351332Matthew Barnes2006-09-191-0/+7 * Make sure default window sizes are positive numbers. Fixes bug 349967.Daniel Gryniewicz2006-08-231-3/+5 * Fix warnings at build-time, and clean up the connections to the D-Bus onBastien Nocera2006-07-271-0/+6 * Fix for #346613. Fix the problem pointed out by JohnnyLi Yuan2006-07-071-1/+1 * Fix for #346613. Make the view_notebook cannot be resized shorter than itsLi Yuan2006-07-061-1/+1 * reviewed by: Srinivasa RagavanSven Herzberg2006-04-281-6/+74 * Commiting patch for bug #337258.Srinivasa Ragavan2006-04-241-1/+1 * Remove unused code and fix format specifiers in some cases.Kjartan Maraas2006-01-301-2/+0 * ** Fixes Bug #257654Rajeev ramanathan2006-01-301-0/+31 * fixing two missing whitespaces. Fixes bug 325568.Andre Klapper2006-01-061-2/+2 * String Fixes (Bug #325122)Harish Krishnaswamy2006-01-011-2/+2 * Evolution is now Network Aware, the day of complete awareness beckons, TheShreyas Srinivasan2005-12-221-2/+15 * committed these files to fix http://bugzilla.gnome.org/show_bug.cgi?id=260354Parthasarathi Susarla2005-12-211-9/+63 * Use libedataserver's e_xml_parse_file() instead of xmlParseFile()Tor Lillqvist2005-12-181-1/+4 * escape the string when generating XML UI description of component switcherDavid Malcolm2005-12-131-2/+7 * Have added the "View Status Bar" under the "View" menu This is a toggleS.Antony Vincent Pandian2005-09-231-1/+18 * Use privsolib instead of privlib. Link with SHELL_LIBS. Use NO_UNDEFINED.Tor Lillqvist2005-08-101-4/+11 * Dont enter default values for button label and menu label Dont add theSarfraaz Ahmed2005-07-251-0/+3 * fix the pixmap location for the settings menu.Not Zed2005-07-211-2/+3 * Free the style here.Kjartan Maraas2005-07-131-0/+1 * shell/ChangeLog shell/e-component-registry.c shell/e-component-registry.hSrinivasa Ragavan2005-05-161-1/+1 * Add profiler so that it gets disted properlyRodney Dawes2005-05-141-3/+2 * Fixes #33287JP Rosevear2005-02-241-0/+1 * Make offline button scale with font size. Fixes #48868.William Jon McCann2005-02-231-3/+8