Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit f94442f

Browse files
committed
Shorten duration formatting, combine host and port, right align PID in instances table. Revert changes to standardise prompts in README
1 parent 359cb6b commit f94442f

File tree

4 files changed

+22
-23
lines changed

4 files changed

+22
-23
lines changed

src/packages/cli/src/cli.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,11 @@ if (argv.action === "start") {
200200
chalk.bold("Flavor"),
201201
chalk.bold("Version"),
202202
chalk.bold("Host"),
203-
chalk.bold("Port"),
204203
chalk.bold("Uptime")
205204
],
205+
colAligns: ["right", "left", "left", "left", "left", "left"],
206206
style: {
207-
head: ["white", "white", "white", "white", "white", "white", "white"]
207+
head: ["white", "white", "white", "white", "white", "white"]
208208
}
209209
});
210210

@@ -218,8 +218,7 @@ if (argv.action === "start") {
218218
porscheColor(instance.name),
219219
instance.flavor,
220220
instance.version,
221-
instance.host,
222-
instance.port.toString(),
221+
`${instance.host}:${instance.port.toString()}`,
223222
formatUptime(uptime)
224223
]);
225224
}

src/packages/cli/src/detach.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -310,15 +310,15 @@ export function formatUptime(ms: number) {
310310
ms = Math.abs(ms);
311311

312312
const time = {
313-
day: Math.floor(ms / 86400000),
314-
hour: Math.floor(ms / 3600000) % 24,
315-
minute: Math.floor(ms / 60000) % 60,
316-
second: Math.floor(ms / 1000) % 60
313+
d: Math.floor(ms / 86400000),
314+
h: Math.floor(ms / 3600000) % 24,
315+
m: Math.floor(ms / 60000) % 60,
316+
s: Math.floor(ms / 1000) % 60
317317
};
318318
const duration = Object.entries(time)
319319
.filter(val => val[1] !== 0)
320-
.map(([key, val]) => `${val} ${key}${val !== 1 ? "s" : ""}`)
321-
.join(", ");
320+
.map(([key, val]) => `${val}${key}`)
321+
.join(" ");
322322

323323
return isFuture ? `In ${duration}` : duration;
324324
}

src/packages/cli/tests/detach.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ describe("@ganache/cli", () => {
1010
[1, "Just started"],
1111
[-1, "Just started"],
1212
[2, "Just started"],
13-
[1000, "1 second"],
14-
[1001, "1 second"],
15-
[-1000, "In 1 second"],
16-
[-1001, "In 1 second"],
17-
[2000, "2 seconds"],
18-
[60000, "1 minute"],
19-
[62000, "1 minute, 2 seconds"],
20-
[1000000, "16 minutes, 40 seconds"],
21-
[-171906000, "In 1 day, 23 hours, 45 minutes, 6 seconds"],
22-
[171906000, "1 day, 23 hours, 45 minutes, 6 seconds"]
13+
[1000, "1s"],
14+
[1001, "1s"],
15+
[-1000, "In 1s"],
16+
[-1001, "In 1s"],
17+
[2000, "2s"],
18+
[60000, "1m"],
19+
[62000, "1m 2s"],
20+
[1000000, "16m 40s"],
21+
[-171906000, "In 1d 23h 45m 6s"],
22+
[171906000, "1d 23h 45m 6s"]
2323
];
2424

2525
durations.forEach(duration => {

src/packages/ganache/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ In case you're upgrading from a previous version of Ganache, we've also written
6060
Once installed globally, you can start ganache right from your command line:
6161

6262
```console
63-
$ ganache
63+
ganache
6464
```
6565

6666
Your output should look something like this:
@@ -230,7 +230,7 @@ In the meantime, check out our [Ethereum JSON-RPC documentation](/src/chains/eth
230230
The startup options are grouped in the `chain`, `database`, `fork`, `logging`, `miner`, and `wallet` namespaces, and should be used as such on startup, i.e.
231231

232232
```console
233-
$ ganache --namespace.option="value"
233+
ganache --namespace.option="value"
234234
```
235235

236236
for CLI use, and
@@ -518,7 +518,7 @@ Process stopped
518518
With the following command, you can start Ganache, run your tests, and stop Ganache when you are finished.
519519

520520
```console
521-
$ GANACHE=$(ganache --detach) && npm run test; ganache instances stop $GANACHE
521+
GANACHE=$(ganache --detach) && npm run test; ganache instances stop $GANACHE
522522
```
523523

524524
Or if you are running PowerShell on Windows, you can do:

0 commit comments

Comments
 (0)