45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
/* -----------------------------------------------
|
|
* executes as standard task
|
|
* ----------------------------------------------- */
|
|
import * as plugins from './mod.plugins.js';
|
|
import * as paths from '../paths.js';
|
|
|
|
import { logger } from '../gitzone.logging.js';
|
|
|
|
export let run = async () => {
|
|
const done = plugins.smartpromise.defer();
|
|
logger.log('warn', 'no action specified');
|
|
|
|
const dirEntries = await plugins.smartfs.directory(paths.templatesDir).list();
|
|
const templates: string[] = [];
|
|
for (const entry of dirEntries) {
|
|
try {
|
|
const stats = await plugins.smartfs
|
|
.file(plugins.path.join(paths.templatesDir, entry.path))
|
|
.stat();
|
|
if (stats.isDirectory) {
|
|
templates.push(entry.name);
|
|
}
|
|
} catch {
|
|
// Skip entries that can't be accessed
|
|
}
|
|
}
|
|
|
|
let projects = `\n`;
|
|
for (const template of templates) {
|
|
projects += ` - ${template}\n`;
|
|
}
|
|
|
|
logger.log(
|
|
'info',
|
|
`
|
|
You can do one of the following things:
|
|
* create a new project with 'gitzone template [template]'
|
|
the following templates exist: ${projects}
|
|
* format a project with 'gitzone format'
|
|
`,
|
|
);
|
|
done.resolve();
|
|
return done.promise;
|
|
};
|