move hash block length to config

pull/4/head
fuwa 5 years ago
parent 5d458d11be
commit 49a1215ca6

@ -35,6 +35,5 @@ const emuHost = '192.168.10.100';
const host = isEmu ? emuHost : '127.0.0.1'; const host = isEmu ? emuHost : '127.0.0.1';
const int hashViewBlock = 6;
const stdoutLineBufferSize = 100; const stdoutLineBufferSize = 100;

@ -93,4 +93,5 @@ final config = CryptoConfig
'--block-sync-size=5', '--block-sync-size=5',
], ],
'[1337@cyberwow]: ', '[1337@cyberwow]: ',
6,
); );

@ -30,6 +30,7 @@ class CryptoConfig {
final int port; final int port;
final List<String> extraArgs; final List<String> extraArgs;
final String promptString; final String promptString;
final int hashViewBlockLength;
const CryptoConfig const CryptoConfig
( (
this.outputBin, this.outputBin,
@ -40,5 +41,6 @@ class CryptoConfig {
this.port, this.port,
this.extraArgs, this.extraArgs,
this.promptString, this.promptString,
this.hashViewBlockLength,
); );
} }

@ -32,11 +32,10 @@ String pretty(dynamic x) {
; ;
} }
String trimHash(String x) => String trimHash(String x) {
x.substring(0, config.hashViewBlock) final l = config.c.hashViewBlockLength;
+ '-' return x.substring(0, l) + '-' + x.substring(l, l * 2) + ' ...';
+ x.substring(config.hashViewBlock, config.hashViewBlock * 2) }
+ ' ...';
Map<String, dynamic> cleanKey(Map<String, dynamic> x) { Map<String, dynamic> cleanKey(Map<String, dynamic> x) {
final _cleaned = x.map final _cleaned = x.map