|
@@ -21,6 +21,8 @@ import http from 'isomorphic-git/http/web';
|
|
import { determine_fetch_remote, find_repo_root, shorten_hash } from '../git-helpers.js';
|
|
import { determine_fetch_remote, find_repo_root, shorten_hash } from '../git-helpers.js';
|
|
import { SHOW_USAGE } from '../help.js';
|
|
import { SHOW_USAGE } from '../help.js';
|
|
import { authentication_options, Authenticator } from '../auth.js';
|
|
import { authentication_options, Authenticator } from '../auth.js';
|
|
|
|
+import { color_options, process_color_options } from '../color.js';
|
|
|
|
+import chalk from 'chalk';
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: 'push',
|
|
name: 'push',
|
|
@@ -37,6 +39,7 @@ export default {
|
|
short: 'f',
|
|
short: 'f',
|
|
},
|
|
},
|
|
...authentication_options,
|
|
...authentication_options,
|
|
|
|
+ ...color_options,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
execute: async (ctx) => {
|
|
execute: async (ctx) => {
|
|
@@ -45,6 +48,8 @@ export default {
|
|
const { options, positionals } = args;
|
|
const { options, positionals } = args;
|
|
const cache = {};
|
|
const cache = {};
|
|
|
|
|
|
|
|
+ process_color_options(options);
|
|
|
|
+
|
|
const { dir, gitdir } = await find_repo_root(fs, env.PWD);
|
|
const { dir, gitdir } = await find_repo_root(fs, env.PWD);
|
|
|
|
|
|
const remotes = await git.listRemotes({
|
|
const remotes = await git.listRemotes({
|
|
@@ -265,12 +270,13 @@ export default {
|
|
stdout(`To ${remote_url}`);
|
|
stdout(`To ${remote_url}`);
|
|
let any_failed = false;
|
|
let any_failed = false;
|
|
for (const { flag, summary, source, dest, reason } of results) {
|
|
for (const { flag, summary, source, dest, reason } of results) {
|
|
- stdout(`${flag === '!' ? '\x1b[31;1m' : ''} ${flag} ${summary.padEnd(19, ' ')}\x1b[0m ${source} -> ${dest}${reason ? ` (${reason})` : ''}`);
|
|
|
|
|
|
+ const flag_and_summary = `${flag} ${summary.padEnd(19, ' ')}`;
|
|
|
|
+ stdout(` ${ (flag === '!') ? chalk.redBright(flag_and_summary) : flag_and_summary } ${source} -> ${dest}${reason ? ` (${reason})` : ''}`);
|
|
if (reason)
|
|
if (reason)
|
|
any_failed = true;
|
|
any_failed = true;
|
|
}
|
|
}
|
|
if (any_failed) {
|
|
if (any_failed) {
|
|
- stderr(`\x1b[31;1merror: Failed to push some refs to '${remote_url}'\x1b[0m`);
|
|
|
|
|
|
+ stderr(chalk.redBright(`error: Failed to push some refs to '${remote_url}'`));
|
|
}
|
|
}
|
|
},
|
|
},
|
|
};
|
|
};
|