mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
docs(help) improve User Menu Example
This commit is contained in:
parent
e1de247dbb
commit
4382d8ca73
1 changed files with 33 additions and 0 deletions
33
HELP.md
33
HELP.md
|
|
@ -493,7 +493,40 @@ module.exports = {
|
|||
|
||||
CloudCmd.refresh();
|
||||
},
|
||||
'C - Create User Menu File': async ({DOM, CloudCmd}) => {
|
||||
const {CurrentInfo} = DOM;
|
||||
|
||||
const {dirPath} = CurrentInfo;
|
||||
const path = `${dirPath}.cloudcmd.menu.js`;
|
||||
const {prefix} = CloudCmd;
|
||||
|
||||
const data = await readDefaultMenu({prefix});
|
||||
await createDefaultMenu({
|
||||
path,
|
||||
data,
|
||||
DOM,
|
||||
CloudCmd,
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
async function createDefaultMenu({path, data, DOM, CloudCmd}) {
|
||||
const {IO} = DOM;
|
||||
|
||||
await IO.write(path, data);
|
||||
await CloudCmd.refresh();
|
||||
|
||||
DOM.setCurrentByName('.cloudcmd.menu.js');
|
||||
|
||||
await CloudCmd.EditFile.show();
|
||||
}
|
||||
|
||||
async function readDefaultMenu({prefix}) {
|
||||
const res = await fetch(`${prefix}/api/v1/user-menu/default`);
|
||||
const data = await res.text();
|
||||
|
||||
return data;
|
||||
}
|
||||
```
|
||||
|
||||
You will have ability to run one of this 3 commands with help of double click, enter, or binded key (`F2`, `D` or `P` in this example). Also you can run commands in terminal, or execute any built-in function of `Cloud Commander` extended it's interface.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue