Skip to content

Commit

Permalink
Add some help notes on arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
TomWright committed Nov 11, 2020
1 parent f9ced61 commit cfd2fef
Showing 1 changed file with 38 additions and 2 deletions.
40 changes: 38 additions & 2 deletions frontend/src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,28 @@
import TopBar from "./TopBar.svelte";
import SelectBox from "./SelectBox.svelte";
import TextArea from "./TextArea.svelte";
import Button from "./Button.svelte";
export let snippet = {
id: null,
input: `{\n "name": "Tom"\n}`,
args: '-p json \'.name\'',
args: '-p json .name',
version: null
}
export let argumentsHelpVisible = false;
async function showArgumentsHelp() {
argumentsHelpVisible = true
console.log(argumentsHelpVisible)
}
async function hideArgumentsHelp() {
argumentsHelpVisible = false
console.log(argumentsHelpVisible)
}
onMount(async () => {
const splitPath = window.location.pathname.split("/")
if (splitPath.length === 3) {
Expand Down Expand Up @@ -144,7 +158,7 @@
<div class="main-input-wrapper">
<div class="input">
<label for="args-input">
Arguments
Arguments <a href="#arguments-help" onclick="return false" on:click="{showArgumentsHelp}">(help)</a>
<TextArea id="args-input" isCode="{true}" bind:value={snippet.args}/>
</label>
</div>
Expand Down Expand Up @@ -177,6 +191,18 @@
<TextArea id="command-output" isCode="{true}" disabled="{true}" bind:value={output}/>
</label>
</Loader>

<div id="arguments-help" class="notes" class:visible={argumentsHelpVisible}>
<p>Use quotes only if the input value contains a space or a quote:</p>
<ul>
<li>put string -p json .text value</li>
<li>put string -p json .text 'Toms value'</li>
<li>put string -p json .text "Tom's value"</li>
</ul>
<p>Including quotes outside of this context may provide unexpected results. Escaping characters is not
supported.</p>
<Button on:click={hideArgumentsHelp}>Close</Button>
</div>
</div>
</main>

Expand Down Expand Up @@ -219,6 +245,16 @@
width: 100%;
}
div.notes {
text-align: left;
font-size: 0.8em;
display: none;
}
div.notes.visible {
display: block;
}
@media (min-width: 640px) {
main {
max-width: 80%;
Expand Down

0 comments on commit cfd2fef

Please sign in to comment.