git-lite-cli
Version:
A lightweight CLI tool for seamless GitHub automation—create, initialize, and push repositories with a single command.
21 lines • 855 B
JavaScript
import { note, text } from '@clack/prompts';
import path from 'path';
import excuter from '../utils/excuter.js';
import getRepo, { getRepoName } from '../utils/repo.js';
import { handleCancel } from '../utils/promptHandler.js';
export default async function cloneTask(auth, userLogin) {
const repoUrl = await text({
message: 'Enter the repository URL to clone:',
});
handleCancel(repoUrl);
const targetDir = await text({
message: 'Enter the target directory to clone into:',
});
handleCancel(targetDir);
const dir = path.resolve(process.cwd(), targetDir.trim());
const cmd = `git clone ${repoUrl} ${dir}`;
await excuter([cmd], { cwd: dir, stdOut: false });
await getRepo(userLogin, getRepoName(repoUrl.trim()), auth, dir);
note(`Repository cloned to ${dir}`);
}
//# sourceMappingURL=clone.js.map