Skip to content

Commit

Permalink
feat: add hotkey to clear the console in wrangler dev
Browse files Browse the repository at this point in the history
Closes #388
  • Loading branch information
petebacondarwin committed Apr 1, 2022
1 parent c04791c commit 972c927
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .changeset/nasty-papayas-happen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"wrangler": patch
---

feat: add hotkey to clear the console in `wrangler dev`

Closes #388
9 changes: 8 additions & 1 deletion packages/wrangler/src/dev/dev.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ function InteractiveDevSession(props: InteractiveDevSessionProps) {
<Text>
{`B to open a browser, D to open Devtools, L to ${
toggles.local ? "turn off" : "turn on"
} local mode, X to exit`}
} local mode, C to clear console, X to exit`}
</Text>
</Box>
</>
Expand Down Expand Up @@ -350,6 +350,13 @@ function useHotkeys(
key
) => {
switch (input.toLowerCase()) {
// clear console
case "c":
console.clear();
// This console.log causes Ink to re-render the `DevSession` component.
// Couldn't find a better way to tell it to do so...
console.log();
break;
// open browser
case "b": {
await openInBrowser(`${localProtocol}://${ip}:${port}`);
Expand Down

0 comments on commit 972c927

Please sign in to comment.