decred / dcrwallet

A secure Decred wallet daemon written in Go (golang).
https://decred.org
ISC License
216 stars 155 forks source link

listtransactions "*" <limit> #40

Closed tpruvot closed 8 years ago

tpruvot commented 8 years ago

To show a custom number of entries i had to use the wallet --terminal to be able to use the "*"

on the linux command line * means all files, tried to quote and use backslashes without success

I suggest to allow the empty string "" as account to list all, like its explained in help (* or unset)

jrick commented 8 years ago

Quoting or escaping the "all accounts" specifier as '*', "*", or \* all work fine here. Tested using both OpenBSD's ksh and GNU bash.

tpruvot commented 8 years ago

hmm indeed with the full command line... i use a dcrw-cli bash script to prevent users and passwords in my bash history

#!/bin/bash CLI=/work/bitcoin/decred/dcrctl OPT="--rpcuser=.... --rpcserver=127.0.0.1:15741" $CLI $OPT --wallet $*

jcvernaleo commented 8 years ago

The various escaping for * works for me in bash scripts as well just like for @jrick when on command lines. I've been doing it that way for a while since I tend to run dcrd (and btcd for that matter) in tmux sessions started by bash scripts so I like to pass commands to it from there.

tpruvot commented 8 years ago

with the above script...

bash --version GNU bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu)

ubuntu 14.04.3 LTS

dcrw-cli listtransactions \ 50 listtransactions command: wrong number of params (expected between 0 and 4, received 11) (code: ErrNumParams) Usage: listtransactions ("account" count=10 from=0 includewatchonly=false) dcrw-cli listtransactions "*" 50 -4: Transactions are not yet grouped by account dcrw-cli listtransactions '' 50 listtransactions command: wrong number of params (expected between 0 and 4, received 11) (code: ErrNumParams) Usage: listtransactions ("account" count=10 from=0 includewatchonly=false)

jcvernaleo commented 8 years ago

Usually, the better way to keep passwords out of your bash history is to put them in the config file for dcrd, dcrwallet, and dcrctl.

While we can't really support the tools you write, in this case I've seen similar enough things to suggest something like: jcv@koopa ~ $ cat test.sh

!/bin/bash

CMD="dcrctl --wallet" exec $CMD "$@"

which works fine for me with: ./test.sh listtransactions "*" 5

tpruvot commented 8 years ago

thanks, will try "$@"