Skip to content
Closed
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
32 changes: 31 additions & 1 deletion src/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ const verboseOpt = new Option(

const colorOpt = new Option("--no-color", "disable color").default(true);

const registryDeprecatedOpt = new Option("-r, --registry <url>")
.argParser(() => true)
.default(false)
.hideHelp(true);

const chdirDeprecatedOpt = new Option("-c, --chdir <path>")
.argParser(() => true)
.default(false)
.hideHelp(true);

/**
* Makes the openupm cli app with the given dependencies.
* @param fetchPackument IO function for fetching registry packuments.
Expand All @@ -52,7 +62,9 @@ export function makeOpenupmCli(
const program = createCommand()
.version(module.exports.version)
.addOption(verboseOpt)
.addOption(colorOpt);
.addOption(colorOpt)
.addOption(chdirDeprecatedOpt)
.addOption(registryDeprecatedOpt);

program.on("option:verbose", function () {
const verbose = program.opts().verbose;
Expand All @@ -68,6 +80,24 @@ export function makeOpenupmCli(
}
});

program.on(`option:${chdirDeprecatedOpt.name()}`, function () {
log.warn(
"",
`--chdir/-c is no longer supported as a global option!
Instead, you should add it to the specific command you are running.
Example: openupm add --chdir /some/path com.my.package`
);
});

program.on(`option:${registryDeprecatedOpt.name()}`, function () {
log.warn(
"",
`--registry/-r is no longer supported as a global option!
Instead, you should add it to the specific command you are running.
Example: openupm add -r https://packages.my-registry.com com.my.package`
);
});

program.addCommand(
makeAddCmd(
fetchCheckUrlExists,
Expand Down
Loading