Skip to content

Commit

Permalink
small improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
charliegerard committed Nov 28, 2023
1 parent 7cd2a4f commit 43794e1
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions lib/commands/info/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ export const info = {

const input = setupCommand(name, info.description, argv, importMeta)
if (input) {
const spinner = ora(`Looking up data for version ${input.pkgVersion} of ${input.pkgName}\n`).start()
const spinnerText = input.pkgVersion === 'latest' ? `Looking up data for the latest version of ${input.pkgName}\n` : `Looking up data for version ${input.pkgVersion} of ${input.pkgName}\n`
const spinner = ora(spinnerText).start()
const packageData = await fetchPackageData(input.pkgName, input.pkgVersion, input, spinner)
if (packageData) {
formatPackageDataOutput(packageData, { name, ...input }, spinner)
Expand Down Expand Up @@ -92,14 +93,8 @@ function setupCommand (name, description, argv, importMeta) {

const versionSeparator = rawPkgName.lastIndexOf('@')

let pkgVersion, pkgName
if (versionSeparator < 1) {
pkgName = rawPkgName
pkgVersion = 'latest'
} else {
pkgName = rawPkgName.slice(0, versionSeparator)
pkgVersion = rawPkgName.slice(versionSeparator + 1)
}
const pkgName = versionSeparator < 1 ? rawPkgName : rawPkgName.slice(0, versionSeparator)
const pkgVersion = versionSeparator < 1 ? 'latest' : rawPkgName.slice(versionSeparator + 1)

return {
includeAllIssues,
Expand Down

0 comments on commit 43794e1

Please sign in to comment.