Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
9a79e6a830 |
@@ -14,7 +14,7 @@ _artix_metro_completion() {
|
||||
# Populate variables
|
||||
repos=("${(s: :)ARTIX_DB}")
|
||||
autorepos=("${(s: :)ARTIX_DB_MAP}")
|
||||
pkgbase=("package") # TODO: populate cloned packages
|
||||
pkgbase=("${(s: :)$(artix-metro --completion pkgbase)}")
|
||||
|
||||
# Handle command and argument contexts
|
||||
_arguments -C \
|
||||
|
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "artix-metro",
|
||||
"version": "3.0.1",
|
||||
"version": "3.0.2",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "artix-metro",
|
||||
"version": "3.0.1",
|
||||
"version": "3.0.2",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"artix-checkupdates": "1.0.1",
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "artix-metro",
|
||||
"version": "3.0.1",
|
||||
"version": "3.0.2",
|
||||
"description": "Automate pushing packages to Artix",
|
||||
"keywords": [
|
||||
"artix",
|
||||
|
@@ -30,14 +30,16 @@ function removeQuotes(str: string) {
|
||||
|
||||
class ArtoolsConfReader {
|
||||
|
||||
async readConf(): Promise<ArtoolsConf> {
|
||||
async readConf(silent: boolean = false): Promise<ArtoolsConf> {
|
||||
const primaryLocation = path.join(os.homedir(), '.config', 'artools', 'artools-pkg.conf');
|
||||
const systemConf = path.join('/', 'etc', 'artools', 'artools-pkg.conf');
|
||||
try {
|
||||
return await this.readConfFile(primaryLocation);
|
||||
}
|
||||
catch (ex) {
|
||||
console.error(`artools config at "${primaryLocation}" could not be read. ${ex}\nUsing system config "${systemConf}" instead.`);
|
||||
if (!silent) {
|
||||
console.error(`artools config at "${primaryLocation}" could not be read. ${ex}\nUsing system config "${systemConf}" instead.`);
|
||||
}
|
||||
return await this.readConfFile(systemConf);
|
||||
}
|
||||
}
|
||||
|
@@ -1,10 +1,12 @@
|
||||
import * as fsp from 'node:fs/promises';
|
||||
import * as readline from 'node:readline/promises';
|
||||
import path from 'node:path';
|
||||
import clc from 'cli-color';
|
||||
import JSON5 from 'json5';
|
||||
import { Writable } from 'stream';
|
||||
import { Pusher } from './pusher.mjs';
|
||||
import { isPasswordRequired } from './runCommand.mjs';
|
||||
import { ArtoolsConfReader } from './artoolsconf.mjs';
|
||||
import type { Job, ArtixpkgRepo } from './pusher.mts';
|
||||
|
||||
/**
|
||||
@@ -44,6 +46,7 @@ async function getGpgPass() {
|
||||
}
|
||||
|
||||
async function artixMetro() {
|
||||
let completion: boolean = false;
|
||||
let job: Partial<Job> = {
|
||||
increment: false,
|
||||
packages: []
|
||||
@@ -64,6 +67,29 @@ async function artixMetro() {
|
||||
const iPlus = i + 1;
|
||||
const args = process.argv;
|
||||
switch (true) {
|
||||
case (arg === '--completion') && iPlus < args.length:
|
||||
const comm = args[iPlus] as string;
|
||||
completion = skipOne = true;
|
||||
switch (comm) {
|
||||
case ('pkgbase'):
|
||||
(new ArtoolsConfReader()).readConf(true).then(async (conf) => {
|
||||
try {
|
||||
console.log(
|
||||
(await fsp.readdir(path.join(conf.workspace, 'artixlinux'), { withFileTypes: true }))
|
||||
.filter(dirent => dirent.isDirectory())
|
||||
.map(dirent => dirent.name).join(' '));
|
||||
process.exit(0);
|
||||
}
|
||||
catch {
|
||||
process.exit(1);
|
||||
}
|
||||
})
|
||||
break;
|
||||
default:
|
||||
console.error(`command "${comm}" not recognized`)
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case (arg === '--job' || arg === '-j') && iPlus < args.length:
|
||||
if (jobfile) {
|
||||
console.error(`multiple jobfiles provided. aborting.`);
|
||||
@@ -111,6 +137,10 @@ async function artixMetro() {
|
||||
}
|
||||
});
|
||||
|
||||
if (completion) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (helpFlag || (!jobfile && !job.repo)) {
|
||||
console.log([
|
||||
`\nUsage: artix-metro [OPTIONS] [commands]...`,
|
||||
@@ -148,6 +178,10 @@ async function artixMetro() {
|
||||
}
|
||||
})();
|
||||
|
||||
if (completion) {
|
||||
return;
|
||||
}
|
||||
|
||||
let pusher = new Pusher({
|
||||
gpgpass: process.env['GPGPASS'] || (await getGpgPass()) || ''
|
||||
});
|
||||
|
Reference in New Issue
Block a user