publishProjectToGithub static method
Future<void>
publishProjectToGithub(
)
Implementation
static Future<void> publishProjectToGithub() async {
bool publishToGitHub = await _askToPublishToGitHub();
if (publishToGitHub) {
// get user repository url
stdout.write('๐ Enter your repository url: ');
final repoUrl = stdin.readLineSync()?.trim() ?? "";
// get user repository commit message [ by default is init project ]
stdout.write(
'๐ Enter your repository commit message [ by default is init project ]: ');
final repoCommitMessage = stdin.readLineSync()?.trim() ?? "init project";
await RunInCmd.runInCmd('git init');
await RunInCmd.runInCmd('git add .');
await RunInCmd.runInCmd('git commit -m "$repoCommitMessage"');
await RunInCmd.runInCmd('git branch -M main');
await RunInCmd.runInCmd('git remote add origin $repoUrl');
await RunInCmd.runInCmd('git push -u origin main');
print("โกโก Publish to GitHub completed successfully\n");
print("๐๐ Repo link: $repoUrl\n");
}
}