11cb0ef41Sopenharmony_ciconst PackageUrlCmd = require('../package-url-cmd.js') 21cb0ef41Sopenharmony_ciclass Docs extends PackageUrlCmd { 31cb0ef41Sopenharmony_ci static description = 'Open documentation for a package in a web browser' 41cb0ef41Sopenharmony_ci static name = 'docs' 51cb0ef41Sopenharmony_ci 61cb0ef41Sopenharmony_ci getUrl (spec, mani) { 71cb0ef41Sopenharmony_ci if (mani.homepage) { 81cb0ef41Sopenharmony_ci return mani.homepage 91cb0ef41Sopenharmony_ci } 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_ci const info = this.hostedFromMani(mani) 121cb0ef41Sopenharmony_ci if (info) { 131cb0ef41Sopenharmony_ci return info.docs() 141cb0ef41Sopenharmony_ci } 151cb0ef41Sopenharmony_ci 161cb0ef41Sopenharmony_ci return `https://www.npmjs.com/package/${mani.name}` 171cb0ef41Sopenharmony_ci } 181cb0ef41Sopenharmony_ci} 191cb0ef41Sopenharmony_cimodule.exports = Docs 20