Skip to content

Commit fa3df72

Browse files
AtkinsSJKernelDeimos
authored andcommitted
feat(git): Add a --debug option, which sets the DEBUG global
I ended up removing the debugging code that used this, but it seems useful anyway for future debug logs.
1 parent 2e4259d commit fa3df72

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

packages/git/src/git-command-definition.js

+5
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ export default {
3434
description: 'Display version information about git.',
3535
type: 'boolean',
3636
},
37+
debug: {
38+
description: 'Enable debug logging to the browser console.',
39+
type: 'boolean',
40+
default: false,
41+
},
3742
},
3843
},
3944
};

packages/git/src/main.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import { produce_usage_string, SHOW_USAGE } from './help.js';
2727
const encoder = new TextEncoder();
2828

2929
window.Buffer = Buffer;
30+
window.DEBUG = false;
3031

3132
window.main = async () => {
3233
const shell = puter.ui.parentApp();
@@ -89,6 +90,9 @@ window.main = async () => {
8990
subcommand_name = 'version';
9091
}
9192

93+
if (global_options.debug)
94+
window.DEBUG = true;
95+
9296
if (!subcommand_name) {
9397
subcommand_name = global_positionals[0];
9498
first_positional_is_subcommand = true;
@@ -111,8 +115,9 @@ window.main = async () => {
111115
subcommand_args.splice(index, 1);
112116

113117
}
114-
remove_arg('--help');
115-
remove_arg('--version');
118+
for (const option_name of Object.keys(git_command.args.options)) {
119+
remove_arg(`--${option_name}`);
120+
}
116121
if (first_positional_is_subcommand) {
117122
// TODO: This is not a 100% reliable way to do this, as it may also match the value of `--option-with-value value`
118123
// But that's not a problem until we add some global options that take a value.

0 commit comments

Comments
 (0)