@putout/plugin-cloudcmd
v5.2.0
Published
🐊Putout plugin adds ability to transform code to new API of Cloud Commander
Downloads
1,490
Maintainers
Readme
@putout/plugin-cloudcmd 
🐊Putout plugin adds ability to transform to new Cloud Commander API.
Install
npm i putout @putout/plugin-cloudcmd -DRules
- ✅ apply-init-module;
- ✅ convert-io-mv-to-io-move;
- ✅ convert-io-cp-to-io-copy;
- ✅ convert-io-delete-to-io-remove;
- ✅ convert-load-dir-to-change-dir;
- ✅ convert-arrow-to-declaration;
Config
{
"rules": {
"cloudcmd/apply-init-module": "on",
"cloudcmd/convert-io-mv-to-io-move": "on",
"cloudcmd/convert-io-cp-to-io-copy": "on",
"cloudcmd/convert-io-delete-to-io-remove": "on",
"cloudcmd/convert-load-dir-to-change-dir": "on",
"cloudcmd/convert-arrow-to-declaration": "on"
},
"plugins": {
"cloudcmd": "on"
}
}convert-io-mv-to-io-move
❌ Example of incorrect code
await IO.mv({
from: dirPath,
to: mp3Dir,
names: mp3Names,
});✅ Example of correct code
await IO.move(dirPath, mp3Dir, mp3Names);convert-io-delete-to-io-remove
❌ Example of incorrect code
await IO.delete('/tmp', ['1.txt']);
await IO.delete('/tmp');✅ Example of correct code
await IO.remove('/tmp', ['1.txt']);
await IO.remove('/tmp');convert-io-cp-to-io-copy
❌ Example of incorrect code
await IO.cp({
from: dirPath,
to: mp3Dir,
names: mp3Names,
});✅ Example of correct code
await IO.copy(dirPath, mp3Dir, mp3Names);convert-io-write-to-io-create-directory
❌ Example of incorrect code
await IO.write(`${mp3Dir}?dir`);✅ Example of correct code
await IO.createDirectory(mp3Dir);convert-load-dir-to-change-dir
Check out in 🐊Putout Editor.
❌ Example of incorrect code
await CloudCmd.loadDir({
path: '/',
panel,
});✅ Example of correct code
await CloudCmd.changeDir('/', {
panel,
});apply-init-module
Check out in 🐊Putout Editor.
❌ Example of incorrect code
CloudCmd.EditFileVim = exports;
CloudCmd[NAME] = exports;✅ Example of correct code
CloudCmd.EditFileVim = {
init,
show,
hide,
};
CloudCmd.NAME = {
init,
show,
hide,
};convert-arrow-to-declaration
Because right now all exported methods saved to global variable on top of a file.
CloudCmd.EditNamesVim = {
init,
show,
hide,
};Check out in 🐊Putout Editor.
❌ Example of incorrect code
export const init = async (hello) => {
await CloudCmd.EditNames();
};
export const show = () => {
Events.addKey(listener);
};
export const hide = () => {
CloudCmd.Edit.hide();
};✅ Example of correct code
export async function init(hello) {
await CloudCmd.EditNames();
}
export function show() {
Events.addKey(listener);
}
export function hide() {
CloudCmd.Edit.hide();
}License
MIT
