File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed
Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change 8888 mode = "execute" ;
8989 } ;
9090 } ;
91+
92+ npm = {
93+ metadata = {
94+ name = "npm" ;
95+ description = "Search and preview installed npm packages" ;
96+ requirements = [ "npm" "jq" ] ;
97+ } ;
98+ source . command = "npm list -g --depth=0 --json 2>/dev/null | jq -r '.dependencies // {} | keys[]' | sort" ;
99+ preview = {
100+ command = ''
101+ npm view '{0}' --json 2>/dev/null | jq -r '"\u001b[1;36m# \(.name):\(.version)\u001b[0m\n\(.description // "")\n\n\u001b[1mHomepage:\u001b[0m \(.homepage // "N/A")\n\u001b[1mLicense:\u001b[0m \(.license // "N/A")\n\u001b[1mKeywords:\u001b[0m \((.keywords // []) | join(", "))"'
102+ '' ;
103+ ansi = true ;
104+ } ;
105+ keybindings . enter = "actions:open" ;
106+ actions . open = {
107+ description = "Open the selected package's homepage" ;
108+ command = "npm view '{0}' homepage | xargs open" ;
109+ mode = "execute" ;
110+ } ;
111+ } ;
112+
113+ pip = {
114+ metadata = {
115+ name = "pip" ;
116+ description = "Search and preview installed pip packages" ;
117+ requirements = [ "pip" "jq" ] ;
118+ } ;
119+ source . command = "pip list --format=json 2>/dev/null | jq -r '.[].name' | sort" ;
120+ preview = {
121+ command = "pip show '{0}'" ;
122+ ansi = false ;
123+ } ;
124+ keybindings . enter = "actions:open" ;
125+ actions . open = {
126+ description = "Open the selected package's homepage" ;
127+ command = "pip show '{0}' | grep 'Home-page:' | awk '{print $2}' | xargs open" ;
128+ mode = "execute" ;
129+ } ;
130+ } ;
91131 } ;
92132 } ;
93133}
You can’t perform that action at this time.
0 commit comments