aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-04-12 14:50:58 +0200
committerMinteck <contact@minteck.org>2022-04-12 14:50:58 +0200
commit637ca7ba746c0241aaec79b79349d5dac4ec7408 (patch)
treeca78ede20f97198de77cccc84c4396b996c0d55e
parentb3ce2bb1e0dd9e0035f003254b4acc4c89e2e72c (diff)
downloadtwilight-637ca7ba746c0241aaec79b79349d5dac4ec7408.tar.gz
twilight-637ca7ba746c0241aaec79b79349d5dac4ec7408.tar.bz2
twilight-637ca7ba746c0241aaec79b79349d5dac4ec7408.zip
Add option to ignore unsafe packages
-rw-r--r--commands/install.js2
-rw-r--r--commands/upgrade.js2
-rw-r--r--index.js6
3 files changed, 8 insertions, 2 deletions
diff --git a/commands/install.js b/commands/install.js
index ebd0a82..f8a238b 100644
--- a/commands/install.js
+++ b/commands/install.js
@@ -159,7 +159,7 @@ module.exports = async (argv) => {
}
try {
- if (!signed && !(await prompts.confirm({
+ if (!signed && !ignoreUnsignedPackages && !(await prompts.confirm({
message: "This package is unsafe, installing it may damage your system. Are you sure you want to continue?",
initial: false
}))) {
diff --git a/commands/upgrade.js b/commands/upgrade.js
index 0113278..6ba31f3 100644
--- a/commands/upgrade.js
+++ b/commands/upgrade.js
@@ -84,7 +84,7 @@ async function processQueue() {
}
try {
- if (!signed && !(await prompts.confirm({
+ if (!signed && !ignoreUnsignedPackages && !(await prompts.confirm({
message: "This package is unsafe, installing it may damage your system. Are you sure you want to continue?",
initial: false
}))) {
diff --git a/index.js b/index.js
index 05caeb5..605fe1c 100644
--- a/index.js
+++ b/index.js
@@ -120,6 +120,10 @@ try {
.help()
.alias("help", "h")
.alias("version", "V")
+ .option('ignore-unsigned-packages', {
+ type: 'boolean',
+ description: 'Do not ask for confirmation when installing an unsigned package update'
+ })
.example("twi install neutron", "Install Neutron")
.example("twi update", "Update all packages")
.example("twi info ponyfind", "Show info about Ponyfind")
@@ -128,6 +132,8 @@ try {
.usage('Usage: twi <command> [arguments...]')
.argv;
+ global.ignoreUnsignedPackages = !!argv.ignoreUnsignedPackages;
+
if (fs.existsSync(home + "/runtime.pid")) {
let pid = fs.readFileSync(home + "/runtime.pid") - 1 + 1;
try {