Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions .gitgo
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"current_issue": {
"number": "51",
"number": "53",
"labels": [
"cli",
"command",
"enhancement"
],
"title": "Add a command to give summary of all instructions"
"title": "Empty specific attributes from .gitgo before pushing it on github"
},
"commit_guidelines": [
"cli:"
"cli:",
"general:"
],
"custom_guidelines": true,
"selected_commit_type": "✨ Adding a new user-facing feature",
"selected_commit_type": "🚀 Improving dev tools",
"emojis": {
"initial_commit": "tada",
"feature": "sparkles",
Expand All @@ -31,11 +31,13 @@
"wip": "construction"
},
"existing_branches": [
"command-summary-instructions",
"main"
],
"current_branch": [
"command-summary-instructions"
"Empty-attributes-github"
],
"current_commit_message": "✨ cli: Add a command to give summary of all instructions",
"use_emojis": true
"current_commit_message": "🚀 cli: Empty specific attributes from .gitgo before pushing it on github",
"use_emojis": true,
"commit_config": false
}
44 changes: 42 additions & 2 deletions bin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ const git = simpleGit();
const { jsonReader } = require("../lib/funcs/jsonReader.js");
const version = require("../package.json");
const chalk = require("chalk");
const { exec } = require("child_process");
const fs = require("fs");

clear();

Expand Down Expand Up @@ -151,8 +153,46 @@ program
return;
}
cMsg = conf.current_commit_message;
git.commit(cMsg);
console.log("Files have be commited: " + cMsg);
if (conf.commit_config) {
conf.commit_config = false;
conf.current_commit_message = "";
conf.current_branch = [""];
conf.existing_branches = [""];
conf.selected_commit_type = "";
conf.current_issue.number = "";
conf.current_issue.labels = [""];
conf.current_issue.title = "";
fs.writeFile("./.gitgo", JSON.stringify(conf, null, 2), (err) => {
if (err) console.log("Error writing file:", err);
});
setTimeout(function () {
exec("git add ./.gitgo", (error, stdout, stderr) => {
if (error) {
console.log(`error: ${error.message}`);
return;
}
if (stderr) {
console.log(`stderr: ${stderr}`);
return;
}
});
git.commit(cMsg);
console.log("Files have be commited: " + cMsg);
}, 1000);
} else {
exec("git reset -- ./.gitgo", (error, stdout, stderr) => {
if (error) {
console.log(`error: ${error.message}`);
return;
}
if (stderr) {
console.log(`stderr: ${stderr}`);
return;
}
});
git.commit(cMsg);
console.log("Files have be commited: " + cMsg);
}
});
} else {
// checks if the directory is a git based repo or not
Expand Down
2 changes: 2 additions & 0 deletions lib/inquirer.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ module.exports = {
return;
}
conf.use_emojis = emo;
conf.commit_config = true;
fs.writeFile(
"./.gitgo",
JSON.stringify(conf, null, 2),
Expand Down Expand Up @@ -170,6 +171,7 @@ module.exports = {
return;
}
conf.use_emojis = emo;
conf.commit_config = true;
fs.writeFile(
"./.gitgo",
JSON.stringify(conf, null, 2),
Expand Down