Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Commit

Permalink
Merge pull request #33 from r8d8/issue/cleanup_cli
Browse files Browse the repository at this point in the history
Lack of proper pront format for `list` command && verbose logging
  • Loading branch information
r8d8 authored Oct 11, 2017
2 parents d05e76f + 91101f5 commit 493d5b8
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 11 deletions.
13 changes: 12 additions & 1 deletion docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Environment variables allow you to redefine the default settings:

## HOWTO

### How to run <<cli.adoc#,`JSON-RPC`>> endpoint
### How to run [JSON-RPC](http://github.com/ethereumproject/emerald-rs/blob/master/docs/api.adoc) endpoint

```
emerald server --host=127.0.0.1 --port=1920
Expand Down Expand Up @@ -96,6 +96,17 @@ or single keyfile for selected <address>:
emerald export --chain=testnet <address> <path_to_export_dir>
```

### How to get balance for address
If using client that running on a local host (127.0.0.1:8545):
```
emerald balance 0x0e7c045110b8dbf29765047380898919c5cb56f4
```
or connecting to some specific host & port:
```
emerald balance 0x0e7c045110b8dbf29765047380898919c5cb56f4 --upstream=8.8.8.8:8545
```


### How to sign transaction

offline:
Expand Down
10 changes: 2 additions & 8 deletions src/cmd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,9 @@ impl CmdExecutor {
fn list(&self) -> ExecResult<Error> {
let accounts_info = self.storage.list_accounts(self.args.flag_show_hidden)?;

println!("Total: {}", accounts_info.len());

println!("{0: <45} {1: <45} ", "ADDRESS", "NAME");
for info in accounts_info {
println!(
"Account: {}, name: {}, description: {}",
&info.address,
&info.name,
&info.description
);
println!("{0: <45} {1: <45} ", &info.address, &info.name);
}

Ok(())
Expand Down
7 changes: 6 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ use std::env;
use std::process::*;

const USAGE: &'static str = include_str!("../usage.txt");
const VERSION: Option<&'static str> = option_env!("CARGO_PKG_VERSION");

/// Get the current Emerald version.
pub fn version() -> &'static str {
VERSION.unwrap_or("unknown")
}

fn main() {
env::set_var("RUST_BACKTRACE", "1");
Expand Down Expand Up @@ -65,7 +70,7 @@ fn main() {
log_builder.init().expect("Expect to initialize logger");

if args.flag_version {
println!("v{}", emerald::version());
println!("v{}", version());
exit(0);
}

Expand Down
2 changes: 1 addition & 1 deletion usage.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Emerald offline wallet command line interface.

Usage:
emerald server [--port=<port>] [--host=<host>] [--base-path=<path>]
emerald server [--port=<port>] [--host=<host>] [--base-path=<path>] [-v | --verbose] [-q | --quite]
emerald new --chain=<chain> ([[--security-level=<level>] [--name=<name>] [--description=<description>]] | --raw <key>)
emerald list --chain=<chain> [--show-hidden]
emerald hide --chain=<chain> <address>
Expand Down

0 comments on commit 493d5b8

Please sign in to comment.