#2540·yargs

Hidden option revealed for implies

Author: xmedekoCreated Jun 2, 2026Updated Sep 5, 2026

When some option is hidden but other option is dependent on it by "implies", then the first option is revealed when the implied option is used.

For example, we have an electron app and Electron apps consumes some debugging options by default, e.g. --remote-debugging-port. We want to allow it on some secret option only:

javascript
const yargs = require('yargs');
const yargsHelpers = require('yargs/helpers');

const options = yargs(yargsHelpers.hideBin(process.argv))
    .option("hidden-debug", {
        type: "boolean",
        hidden: true
    })
    .option("remote-debugging-port", { hidden: true })
    .implies("remote-debugging-port", "hidden-debug")
    .help()
    .strict(true)
    .parse();

However, when someone tries to run the app with --remote-debugging-port only, yargs fails and shows:

Missing dependent arguments:
 remote-debugging-port -> hidden-debug

So, the user knows what option to use, then

IMO when hidden-debug is hidden, it should not be printed in error messages, too.