Skip to content

Commit 22a0bfa

Browse files
committed
feat: finalize signals
1 parent 1e31d32 commit 22a0bfa

File tree

12 files changed

+52
-57
lines changed

12 files changed

+52
-57
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,14 +280,14 @@ inject: ["exit", "terminal"],
280280

281281
## Signals
282282

283-
It's possible to send and receive signals like `SIGINT`, `SIGTERM` or `SIGKILL`.
284-
`SIGINT` is the only implemented signal. When the terminal user clicks
285-
<kbd>Ctrl</kbd> + <kbd>c</kbd>, you can listen to the event by providing the
283+
You can send and receive signals like `SIGINT`, `SIGTERM` or `SIGKILL`.
284+
`SIGINT` is the only implemented signal for now. When the user presses
285+
<kbd>Ctrl</kbd> + <kbd>c</kbd>, you can listen to this event by providing a
286286
signal name and a callback:
287287

288288
```js
289289
const signals = inject("signals");
290-
signals.on("SIGNINT", () => console.debug("SIGINT"));
290+
signals.on("SIGINT", () => console.debug("SIGINT"));
291291
```
292292

293293
## Nice-to-haves

docs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><!--[if IE]><link rel="icon" href="favicon.ico"><![endif]--><title>vue-command</title><link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous"><link href="css/app.dc600676.css" rel="preload" as="style"><link href="js/app.ccacc744.js" rel="preload" as="script"><link href="js/chunk-vendors.237296fb.js" rel="preload" as="script"><link href="css/app.dc600676.css" rel="stylesheet"><link rel="icon" type="image/png" sizes="32x32" href="img/icons/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="img/icons/favicon-16x16.png"><link rel="manifest" href="manifest.json"><meta name="theme-color" content="#4DBA87"><meta name="apple-mobile-web-app-capable" content="no"><meta name="apple-mobile-web-app-status-bar-style" content="default"><meta name="apple-mobile-web-app-title" content="vue-command"><link rel="apple-touch-icon" href="img/icons/apple-touch-icon-152x152.png"><link rel="mask-icon" href="img/icons/safari-pinned-tab.svg" color="#4DBA87"><meta name="msapplication-TileImage" content="img/icons/msapplication-icon-144x144.png"><meta name="msapplication-TileColor" content="#000000"></head><body><noscript><strong>We're sorry but vue-command doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="js/chunk-vendors.237296fb.js"></script><script src="js/app.ccacc744.js"></script></body></html>
1+
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><!--[if IE]><link rel="icon" href="favicon.ico"><![endif]--><title>vue-command</title><link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous"><link href="css/app.dc600676.css" rel="preload" as="style"><link href="js/app.1c48fd61.js" rel="preload" as="script"><link href="js/chunk-vendors.237296fb.js" rel="preload" as="script"><link href="css/app.dc600676.css" rel="stylesheet"><link rel="icon" type="image/png" sizes="32x32" href="img/icons/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="img/icons/favicon-16x16.png"><link rel="manifest" href="manifest.json"><meta name="theme-color" content="#4DBA87"><meta name="apple-mobile-web-app-capable" content="no"><meta name="apple-mobile-web-app-status-bar-style" content="default"><meta name="apple-mobile-web-app-title" content="vue-command"><link rel="apple-touch-icon" href="img/icons/apple-touch-icon-152x152.png"><link rel="mask-icon" href="img/icons/safari-pinned-tab.svg" color="#4DBA87"><meta name="msapplication-TileImage" content="img/icons/msapplication-icon-144x144.png"><meta name="msapplication-TileColor" content="#000000"></head><body><noscript><strong>We're sorry but vue-command doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="js/chunk-vendors.237296fb.js"></script><script src="js/app.1c48fd61.js"></script></body></html>

docs/js/app.1c48fd61.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/js/app.1c48fd61.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/js/app.ccacc744.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

docs/js/app.ccacc744.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/precache-manifest.2032eed84a887953ede510352a11da7d.js renamed to docs/precache-manifest.4af45eb0bd164658140cfe45f68b9fbb.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
self.__precacheManifest = (self.__precacheManifest || []).concat([
22
{
3-
"revision": "41ea92d2220469da0ef2",
3+
"revision": "08f3678f038dd723afed",
44
"url": "css/app.dc600676.css"
55
},
66
{
7-
"revision": "b825913d9118f944000bde80bed82a17",
7+
"revision": "d456809b0afff9e778f5d74e4f5c74e0",
88
"url": "index.html"
99
},
1010
{
11-
"revision": "41ea92d2220469da0ef2",
12-
"url": "js/app.ccacc744.js"
11+
"revision": "08f3678f038dd723afed",
12+
"url": "js/app.1c48fd61.js"
1313
},
1414
{
1515
"revision": "37263e520d1b52d48297",

docs/service-worker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");
1515

1616
importScripts(
17-
"precache-manifest.2032eed84a887953ede510352a11da7d.js"
17+
"precache-manifest.4af45eb0bd164658140cfe45f68b9fbb.js"
1818
);
1919

2020
workbox.core.setCacheNameDetails({prefix: "vue-command"});

src/components/VueCommand.vue

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ const dispatch = async () => {
352352
353353
// Command is user created component. Decorate component
354354
const component = defineComponent({
355+
name: 'VueCommandEntryComponent',
355356
provide () {
356357
return {
357358
// This will be unique for the component and not reactive by design
@@ -376,23 +377,23 @@ const exit = () => {
376377
setFullscreen(false)
377378
setQuery('')
378379
}
379-
const incrementHistory = () => {
380-
// History pointer must be lower query history
381-
if (!lt(local.historyPosition, local.dispatchedQueries.size)) {
380+
const decrementHistory = () => {
381+
// History pointer must be greater zero
382+
if (eq(local.historyPosition, 0)) {
382383
return
383384
}
384385
385-
setHistoryPosition(local.historyPosition + 1)
386+
setHistoryPosition(local.historyPosition - 1)
386387
const query = nth([...local.dispatchedQueries], local.historyPosition)
387388
setQuery(query)
388389
}
389-
const decrementHistory = () => {
390-
// History pointer must be greater zero
391-
if (eq(local.historyPosition, 0)) {
390+
const incrementHistory = () => {
391+
// History pointer must be lower query history
392+
if (!lt(local.historyPosition, local.dispatchedQueries.size)) {
392393
return
393394
}
394395
395-
setHistoryPosition(local.historyPosition - 1)
396+
setHistoryPosition(local.historyPosition + 1)
396397
const query = nth([...local.dispatchedQueries], local.historyPosition)
397398
setQuery(query)
398399
}
@@ -402,7 +403,6 @@ const scrollToBottom = async () => {
402403
vueCommandHistoryRef.value.scrollTop = vueCommandHistoryRef.value.scrollHeight
403404
}
404405
const sendSignal = signal => {
405-
console.log(signal)
406406
signals[PUBLISH_SYMBOL](signal)
407407
}
408408
const setCursorPosition = cursorPosition => {

src/hosted/App.vue

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,6 @@ export default {
128128
return createStdout(tableFormatter(history))
129129
},
130130
131-
json: () => {
132-
return createStdout(jsonFormatter({ test: 1 }))
133-
},
134-
135131
nano: () => NanoEditor,
136132
norris: () => ChuckNorris
137133
},

0 commit comments

Comments
 (0)