Giter Site home page Giter Site logo

to-where-cli's Introduction

If you want to know more about the usage, please refer to the documentation.

to-where-cli

npm version Build Status install size npm downloads

Currently only supports macOS, Windows

Use the alias mechanism to help you open obscure URLs that are hard to remember. Helps you to open various addresses of github repositories, straight to the search page of npm, google and other sites.

Features

  • Open hard-to-remember websites by alias
  • Open various pages of the github repository (issue, pull request, start...)
  • Go straight to the search npm page
  • Go straight to the search github page
  • Go straight to the search google page
  • Go straight to the search bing page
  • Go straight to the search baidu page

Install

npm install -g to-where-cli

Basic usage

  • Add an alias to your address
tw add home https://github.com/skypesky
  • Open address by alias
tw home
  • Update the address of the alias
tw add home https://github.com/skypesky/leetcode-for-javascript
  • List existing alias home
tw ls home
  • Remove an alias from your address
tw rm home
  • Show help information
tw -h

to-where-cli's People

Contributors

lancelotlewis avatar skypesky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

lancelotlewis

to-where-cli's Issues

[Feature]: 不支持 WSL 打开链接

Why you want this Feature?

open-cli 可以在 WSL 打开 windows 界面

Describe the solution you'd like

No response

Additional context

No response

构建使用文档

Why you want this Feature?

构建使用文档

Describe the solution you'd like

No response

Additional context

No response

[Feature] 迁移到 pnpm

Target / Intent / Why you want this Feature

Describe the solution you'd like

Additional context

[Bug] 移除不必要的依赖

Describe the bug

image

To Reproduce

Steps to reproduce the behavior:

  1. Go to 'Page'

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

[Feature]: tw xxx 要是能支持自动完成的话,简直完美

Why you want this Feature?

tw xxx 要是能支持自动完成的话,简直完美

Describe the solution you'd like

No response

Additional context

related: commander-completion https://github.com/twolfson/commander-completion
related: @fig/complete-commander https://github.com/withfig/autocomplete-tools/blob/main/integrations/commander/README.md

related: myangvgo/leetcode-with-js#30 (comment)
related: 参考 pnpm 的自动完成 https://pnpm.io/zh/completion

[Bug]: npm install -g to-where-cli throw an error: npm ERR! [email protected] preinstall: `npx only-allow pnpm`

Describe the bug

npm install -g to-where-cli throw an error: npm ERR! [email protected] preinstall: npx only-allow pnpm

Reproduction Steps

    1. install
npm install -g to-where-cli
    1. output error message
damner@codedamn:/home/damner/code$ npm install -g to-where-cli
(node:131) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
(Use `node --trace-warnings ...` to show where the warning was created)

> [email protected] preinstall /usr/lib/node_modules/to-where-cli
> npx only-allow pnpm

(node:166) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
(Use `node --trace-warnings ...` to show where the warning was created)
npx: installed 20 in 1.861s
╔═════════════════════════════════════════════════════════════╗
║                                                             ║
║   Use "pnpm install" for installation in this project.      ║
║                                                             ║
║   If you don't have pnpm, install it via "npm i -g pnpm".   ║
║   For more details, go to https://pnpm.js.org/              ║
║                                                             ║
╚═════════════════════════════════════════════════════════════╝
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] preinstall: `npx only-allow pnpm`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] preinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/damner/.npm/_logs/2023-02-01T16_55_56_427Z-debug.log

Observed Behavior

install successfully!

Expected Behavior

install failed!

Possible Solution

No response

Additional Information/Context

related install env: https://codedamn.com/online-compiler/node#start

npm install -g to-where-cli@beta

[Bug] 更新到最新版的时候,to-where-cli 报错了

Describe the bug

To Reproduce

Steps to reproduce the behavior:

  1. Go to 'Page'

Screenshots

If applicable, add screenshots to help explain your problem.

TypeError: Cannot read properties of undefined (reading 'argument')
    at U0 (/Users/skypesky/.nvm/versions/node/v16.17.1/lib/node_modules/to-where-cli/dist/index.js:83:5394)
    at /Users/skypesky/.nvm/versions/node/v16.17.1/lib/node_modules/to-where-cli/dist/index.js:83:5620
    at Object.<anonymous> (/Users/skypesky/.nvm/versions/node/v16.17.1/lib/node_modules/to-where-cli/dist/index.js:83:5638)
    at Module._compile (node:internal/modules/cjs/loader:1126:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
    at Module.load (node:internal/modules/cjs/loader:1004:32)
    at Function.Module._load (node:internal/modules/cjs/loader:839:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47
[~/workSpaces/javascript/arcblock/did-storage]$ tw list                                                                               [sync]
/Users/skypesky/.nvm/versions/node/v16.17.1/lib/node_modules/to-where-cli/dist/index.js:83
`:""}var tS=rS,iS={dump:tS};function Ss(e,r){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+r+" instead, which is now safe by default.")}}var oS=De,uS=Fc,sS=Lc,lS=Mc,aS=qc,fS=vs,cS=nh.load,hS=nh.loadAll,pS=iS.dump,dS=Ge,mS={binary:Uc,float:Nc,map:kc,null:Pc,pairs:Yc,set:Vc,timestamp:Wc,bool:Rc,int:Dc,merge:Hc,omap:Gc,seq:Ic,str:Tc},gS=Ss("safeLoad","load"),_S=Ss("safeLoadAll","loadAll"),yS=Ss("safeDump","dump"),vS={Type:oS,Schema:uS,FAILSAFE_SCHEMA:sS,JSON_SCHEMA:lS,CORE_SCHEMA:aS,DEFAULT_SCHEMA:fS,load:cS,loadAll:hS,dump:pS,YAMLException:dS,types:mS,safeLoad:gS,safeLoadAll:_S,safeDump:yS},Es=vS;var dr=On(Ws()),xd=On(Hs()),Ad=require("path"),Sd=require("os"),Us=class{constructor(r={}){this.options={};this.options.configPath=r.configPath??Us.DEFAULT_CONFIG_PATH,(0,dr.ensureFileSync)(this.options.configPath)}async set(r){await(0,dr.outputFile)(this.options.configPath,Es.dump(r))}async get(){let r=await(0,dr.readFile)(this.options.configPath,"utf-8"),i=Es.load(r)??{};return i.points=i.points??[],i}async add(r){let i=await this.get();await this.exists(r.alias)?await this.update(r):(i.points.push(r),await this.set(i))}async delete(r){let i=await this.get();for(let o=0;o<i.points.length;o++)i.points[o].alias===r&&i.points.splice(o,1);await this.set(i)}async update(r){let i=await this.get();for(let o of i.points)if(o.alias===r.alias){o.address=r.address;break}await this.set(i)}async exists(r){let i=await this.find(r);return!(0,xd.isUndefined)(i)}async find(r){return(await this.findAll()).find(o=>o.alias===r)}async findAll(){return(await this.get()).points}async deleteAll(){let r=await this.get();r.points.length=0,await this.set(r)}async destroy(){(0,dr.removeSync)(this.options.configPath)}},Jt=Us;Jt.DEFAULT_CONFIG_PATH=(0,Ad.join)((0,Sd.homedir)(),".tw.config.yml");var Kn=console;var g0=On(Hs()),gr=On(r0()),_0=On(sl()),ll=class{constructor(r=new Jt){this.config=r}async open(r){let i=await this.config.find(r);if(!i){Kn.error(`Alias ${gr.default.red(r)} was not found`);return}await(0,_0.default)(i.address)}async add(r){let i=await this.config.find(r.alias);if(i&&!r.force){Kn.error(`Alias ${gr.default.red(r.alias)} already exists, you can use '-f' or '--force' to overwrite it`),this.prettyPrint([i]);return}let o=(0,g0.pick)(r,["alias","address"]);return await this.config.add(o),Kn.info("Added successfully"),this.prettyPrint([o]),o}async delete(r){let i=await this.config.find(r);if(!i){Kn.error(`Alias ${gr.default.red(r)} was not found`);return}await this.config.delete(r),Kn.info(`Alias ${gr.default.blue(r)} has been removed`),this.prettyPrint([i])}async list(r){if(r){let o=await this.config.find(r);if(!o){Kn.error(`Alias ${gr.default.red(r)} was not found`);return}this.prettyPrint([o]);return}let i=await this.config.findAll();this.prettyPrint(i)}async clean(r=!1){if(!r){Kn.error("To make sure you know what you're doing, you must use '-f' or '--force' to empty");return}await this.config.deleteAll()}prettyPrint(r){for(let i of r)Kn.info(`${gr.default.blue(i.alias)} => ${gr.default.cyan(i.address)}`)}},Rn=new ll;var y0=require("path");var al=new yn;al.name("add").description("Add an alias to your address").argument("[alias]","Give your address an alias").argument("[address]","your address").option("-f, --force","Overwrite existing alias",!1).action((e,r,i)=>{e?r||(r=process.cwd()):(r=process.cwd(),e=(0,y0.basename)(r));let o=i.force;Rn.add({alias:e,address:r,force:o})});var fl=new yn;fl.name("clean").description("Clear existing aliases").option("-f, --force","force empty",!1).action(async(e,r)=>{let i=r.opts().force;await Rn.clean(i)});var cl=new yn;cl.name("list").description("List existing aliases and addresses").action(async(e,r)=>{let[i]=r.args;await Rn.list(i)});var hl=new yn;hl.name("rm").description("Remove an alias from your address").argument("<point>","TODO").action(e=>{Rn.delete(e)});var q0=On(F0()),$0=On(sl()),Dn=On(I0()),ei=On(M0()),ml=new yn;ml.name("git").command("open").description("Open github repo page, issues page, pr page, ...etc").option("-a, --actions","Open actions page",!1).option("--author","Open author profile page",!1).option("-c, --committer","Open committer profile",!1).option("-i, --issue","Open issues list page",!1).option("-m, --main","Open main branch page",!1).option("-p, --pull-request","Open pull request list page",!1).option("-r, --release","Open release page",!1).option("-s, --settings","Open settings page",!1).option("--sha","Open current sha page",!1).action(async e=>{let r=e.actions,i=e.author,o=e.issue,u=e.pullRequest,l=e.release,a=e.sha,h=e.committer,p=e.main,y=e.settings,g=await(0,q0.default)();if(r)g=(0,Dn.default)(g,"actions");else if(o)g=(0,Dn.default)(g,"issues");else if(u)g=(0,Dn.default)(g,"pulls");else if(i){let w=(0,ei.default)(),[C]=w.author.split(" ");g=(0,Dn.default)(new URL(g).origin,C)}else if(l)g=(0,Dn.default)(g,"releases");else if(h){let w=(0,ei.default)(),[C]=w.author.split(" ");g=(0,Dn.default)(new URL(g).origin,C)}else if(!p)if(y)g=(0,Dn.default)(g,"settings");else if(a){let w=(0,ei.default)();g=(0,Dn.default)(g,"commit",w.sha)}else{let C=(0,ei.default)().branch;g=(0,Dn.default)(g,"tree",C)}await(0,$0.default)(g)});var B0=On(Ws()),W0=require("process"),H0=require("path"),TO=(0,B0.readJsonSync)((0,H0.join)((0,W0.cwd)(),"package.json"));function U0(){let e=new yn;return e.name("tw").version(TO.version).argument("[alias]","Give your address an alias").action(async r=>{if(r)return await Rn.open(r),process.exit(0);e.help()}),e.addCommand(al),e.addCommand(hl),e.addCommand(cl),e.addCommand(fl),e.addCommand(ml),e}(async()=>await U0().parseAsync())();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            

TypeError: Cannot read properties of undefined (reading 'argument')
    at U0 (/Users/skypesky/.nvm/versions/node/v16.17.1/lib/node_modules/to-where-cli/dist/index.js:83:5394)
    at /Users/skypesky/.nvm/versions/node/v16.17.1/lib/node_modules/to-where-cli/dist/index.js:83:5620
    at Object.<anonymous> (/Users/skypesky/.nvm/versions/node/v16.17.1/lib/node_modules/to-where-cli/dist/index.js:83:5638)
    at Module._compile (node:internal/modules/cjs/loader:1126:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
    at Module.load (node:internal/modules/cjs/loader:1004:32)
    at Function.Module._load (node:internal/modules/cjs/loader:839:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)

Additional context

参考: https://github.com/facebook/jest

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.