mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-22 07:08:10 +00:00
move available commands popover to command help
This commit is contained in:
parent
eec3c35cb1
commit
689fde87a2
@ -13,6 +13,27 @@ exports[`CommandBar Component 1`] = `
|
|||||||
<div
|
<div
|
||||||
class="command-result"
|
class="command-result"
|
||||||
/>
|
/>
|
||||||
|
<div
|
||||||
|
class="argument-suggestion popover top"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="arrow"
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
class="popover-content"
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
<strong>
|
||||||
|
Available Commands:
|
||||||
|
</strong>
|
||||||
|
<p
|
||||||
|
class="available-commands"
|
||||||
|
>
|
||||||
|
[]
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div
|
<div
|
||||||
class="command-input input-group"
|
class="command-input input-group"
|
||||||
>
|
>
|
||||||
@ -30,11 +51,6 @@ exports[`CommandBar Component 1`] = `
|
|||||||
value=""
|
value=""
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div
|
|
||||||
class="available-commands popover bottom"
|
|
||||||
>
|
|
||||||
Available Commands: []
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</DocumentFragment>
|
</DocumentFragment>
|
||||||
`;
|
`;
|
||||||
|
@ -14,7 +14,7 @@ function getAvailableCommands(commands, input = "") {
|
|||||||
return availableCommands
|
return availableCommands
|
||||||
}
|
}
|
||||||
|
|
||||||
export function CommandHelp({nextArgs, currentArg, help, description}){
|
export function CommandHelp({nextArgs, currentArg, help, description, availableCommands}){
|
||||||
let results = []
|
let results = []
|
||||||
for (let i = 0; i < nextArgs.length; i++) {
|
for (let i = 0; i < nextArgs.length; i++) {
|
||||||
if (i==currentArg) {
|
if (i==currentArg) {
|
||||||
@ -26,9 +26,10 @@ export function CommandHelp({nextArgs, currentArg, help, description}){
|
|||||||
return (<div className="argument-suggestion popover top">
|
return (<div className="argument-suggestion popover top">
|
||||||
<div className="arrow"/>
|
<div className="arrow"/>
|
||||||
<div className="popover-content">
|
<div className="popover-content">
|
||||||
<div><strong>Argument suggestion:</strong> {results}</div>
|
{ results.length > 0 && <div><strong>Argument suggestion:</strong> {results}</div> }
|
||||||
{ help.includes("->") && <div><strong>Signature help: </strong>{help}</div>}
|
{ help.includes("->") && <div><strong>Signature help: </strong>{help}</div>}
|
||||||
{ description && <div># {description}</div>}
|
{ description && <div># {description}</div>}
|
||||||
|
<div><strong>Available Commands: </strong><p className="available-commands">{JSON.stringify(availableCommands)}</p></div>
|
||||||
</div>
|
</div>
|
||||||
</div>)
|
</div>)
|
||||||
}
|
}
|
||||||
@ -151,7 +152,7 @@ export default function CommandBar() {
|
|||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
{ signatureHelp && <CommandHelp nextArgs={nextArgs} currentArg={currentArg} help={signatureHelp} description={description}/> }
|
<CommandHelp nextArgs={nextArgs} currentArg={currentArg} help={signatureHelp} description={description} availableCommands={availableCommands} />
|
||||||
<div className={classnames('command-input input-group')}>
|
<div className={classnames('command-input input-group')}>
|
||||||
<span className="input-group-addon">
|
<span className="input-group-addon">
|
||||||
<i className={'fa fa-fw fa-terminal'}/>
|
<i className={'fa fa-fw fa-terminal'}/>
|
||||||
@ -166,7 +167,6 @@ export default function CommandBar() {
|
|||||||
onKeyUp={onKeyUp}
|
onKeyUp={onKeyUp}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="available-commands popover bottom">Available Commands: {JSON.stringify(availableCommands)}</div>
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user