@@ -28,6 +28,7 @@ import require$$0$9 from 'diagnostics_channel';
2828import require$$2$2 from 'child_process';
2929import require$$6$1 from 'timers';
3030import { chmodSync } from 'node:fs';
31+ import { join } from 'node:path';
3132
3233var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
3334
@@ -29857,10 +29858,10 @@ class GpgCli {
2985729858 }
2985829859 }
2985929860 async import(ascPath) {
29860- await execOutput(this.name, ['--import', ascPath]);
29861+ await execOutput(this.name, ['--import', ascPath], { silent: false, failOnStdErr: false } );
2986129862 }
2986229863 async verify(sigPath, binPath) {
29863- await execOutput(this.name, ['--verify', sigPath, binPath]);
29864+ await execOutput(this.name, ['--verify', sigPath, binPath], { silent: false, failOnStdErr: false } );
2986429865 }
2986529866 async help() {
2986629867 const { stdout } = await execOutput(this.name, ['--help']);
@@ -29914,6 +29915,10 @@ class TrdlCli {
2991429915 const { stdout } = await execOutput(this.name, ['list']);
2991529916 return stdout.slice(1).map(parseLineToItem);
2991629917 }
29918+ async version() {
29919+ const { stdout } = await execOutput(this.name, ['version'], { silent: false });
29920+ return stdout.join('');
29921+ }
2991729922}
2991829923function parseLineToItem(line) {
2991929924 const [name, url, default_, channel] = line.trim().split(/ +/);
@@ -29998,27 +30003,30 @@ async function downloadParallel(binUrl, sigUrl, ascUrl) {
2999830003function findTrdlCache(toolName, toolVersion) {
2999930004 return toolCacheExports.find(toolName, toolVersion);
3000030005}
30001- async function installTrdl(toolName, toolVersion, binPath ) {
30006+ async function installTrdl(binPath, toolName, toolVersion ) {
3000230007 // install tool
30003- const installedPath = await toolCacheExports.cacheFile(binPath, toolName, toolName, toolVersion);
30008+ const cachedPath = await toolCacheExports.cacheFile(binPath, toolName, toolName, toolVersion);
30009+ const cachedFile = join(cachedPath, toolName);
30010+ coreExports.info(format('cached file=%s', cachedFile));
3000430011 // set permissions
30005- chmodSync(installedPath , 0o755);
30012+ chmodSync(cachedFile , 0o755);
3000630013 // add tool to $PATH
30007- coreExports.addPath(installedPath );
30014+ coreExports.addPath(cachedFile );
3000830015}
3000930016async function Run() {
30017+ coreExports.setCommandEcho(coreExports.isDebug());
3001030018 const trdlCli = new TrdlCli();
3001130019 const gpgCli = new GpgCli();
3001230020 const inputs = parseInputs();
3001330021 await Do(trdlCli, gpgCli, inputs);
3001430022}
3001530023async function Do(trdlCli, gpgCli, inputs) {
3001630024 coreExports.startGroup('Install or self-update trdl.');
30017- coreExports.debug (format(`parsed inputs=%o`, inputs));
30025+ coreExports.info (format(`parsed inputs=%o`, inputs));
3001830026 const defaults = trdlCli.defaults();
30019- coreExports.debug (format(`trdl defaults=%o`, defaults));
30027+ coreExports.info (format(`trdl defaults=%o`, defaults));
3002030028 const options = await getOptions(inputs, defaults);
30021- coreExports.debug (format(`installation options=%o`, options));
30029+ coreExports.info (format(`installation options=%o`, options));
3002230030 const toolCache = findTrdlCache(defaults.repo, options.version);
3002330031 if (toolCache) {
3002430032 coreExports.info(`Installation skipped. trdl@v${options.version} is found at path ${toolCache}.`);
@@ -30030,16 +30038,19 @@ async function Do(trdlCli, gpgCli, inputs) {
3003030038 }
3003130039 await gpgCli.mustGnuGP();
3003230040 const [binUrl, sigUrl, ascUrl] = formatDownloadUrls(options.version);
30033- coreExports.debug (format('%s bin_url =%s', defaults.repo, binUrl));
30034- coreExports.debug (format('%s sig_url =%s', defaults.repo, sigUrl));
30035- coreExports.debug (format('%s asc_url =%s', defaults.repo, ascUrl));
30036- coreExports.info('Downloading signatures.');
30041+ coreExports.info (format('%s binUrl =%s', defaults.repo, binUrl));
30042+ coreExports.info (format('%s sigUrl =%s', defaults.repo, sigUrl));
30043+ coreExports.info (format('%s ascUrl =%s', defaults.repo, ascUrl));
30044+ coreExports.info('Downloading binary and signatures.');
3003730045 const [binPath, sigPath, ascPath] = await downloadParallel(binUrl, sigUrl, ascUrl);
3003830046 coreExports.info('Importing and verifying gpg keys.');
3003930047 await gpgCli.import(ascPath);
3004030048 await gpgCli.verify(sigPath, binPath);
3004130049 coreExports.info('Installing trdl and adding it to the $PATH.');
30042- await installTrdl(defaults.repo, options.version, binPath);
30050+ await installTrdl(binPath, defaults.repo, options.version);
30051+ coreExports.info('Showing installed version.');
30052+ const version = await trdlCli.version();
30053+ coreExports.info(format('Installed version: trdl@%s', version));
3004330054 coreExports.endGroup();
3004430055}
3004530056
0 commit comments