Skip to main content

$disable

To prevent a specific script from running, use the $disable directive within the scripts object.

If you have:

export default {
scripts: {
"yourScript": "someCommand",
}
}

and want to disable that script, just use $disable directive:

export default {
scripts: {
"$disable (yourScript)": "someCommand",
}
}
What is the difference between using the $disable directive and simply removing or commenting out the line?
export default {
scripts: {
// "yourScript": "someCommand",
}
}

At first sight, it may seem the same, but it's not. Check the following example:

export default {
scripts: {
"yourScript1": "echo someText1",
"yourScript2": "echo someText2",
"yourScript3": "echo someText3",
"chain": "jko -l=w yourScript1 && jko -l=w yourScript2 && jko -l=w yourScript3",
}
}

If you want to disable yourScript2, and do it by commenting out the respective line:

export default {
scripts: {
"yourScript1": "echo someText1",
// "yourScript2": "echo someText2",
"yourScript3": "echo someText3",
"chain": "jko -l=w yourScript1 && jko -l=w yourScript2 && jko -l=w yourScript3",
}
}

If you then run chain, jko will attempt to retrieve yourScript2, but it will not be found. An error will be shown, and the chaining will stop:

$ jko chain someText1

jko error - yourScript2 not found, similar scripts are:

yourScript1: 'someCommand'
yourScript3: 'someCommand'

jko end - chain: "jko -l=w yourScript1 && jko -l=w yourScript2 && jko -l=w yourScript3" Failed.

yourScript3 is not executed.

However, when it is disabled:

export default {
scripts: {
"yourScript1": "echo someText1",
"$disable (yourScript2)": "echo someText2",
"yourScript3": "echo someText3",
"chain": "jko -l=w yourScript1 && jko -l=w yourScript2 && jko -l=w yourScript3",
}
}

$ jko chain someText1

jko warn - [DISABLED] yourScript2 was skipped.

someText3

jko end - Successful execution of chain.

info

When jko is executed without parameters, it lists the available scripts. Additionally, if a script has been disabled, [DISABLED] will be displayed after the script's definition information.

$ jko scripts: yourScript: someCommand [DISABLED]

Was this content valuable?