Skip to content

Commit

Permalink
Improve README
Browse files Browse the repository at this point in the history
refactor error message to scan name
  • Loading branch information
carakan committed Oct 17, 2018
1 parent e425d86 commit 7e662e4
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 39 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
Vim plugin that provides functions to interact with your package/lib manager for your
favorite language and it's generic!

### Supported languages and package managers:

- [x] Elixir, hex
- [x] NodeJS, npm/yarn
- [x] Ruby, rubygems
- [x] Rust, cargo/cratos

### Prerequisites

This plugin uses [mattn/webapi-vim](https://github.com/mattn/webapi-vim).
Expand Down Expand Up @@ -91,11 +98,6 @@ By default is:

# TODO's

- Supported languages and package managers:
- [x] Elixir, hex
- [x] NodeJS, npm/yarn
- [x] Ruby, rubygems
- [x] Rust, cargo/cratos
- Refactor
- Async API calls
- Test's
Expand Down
5 changes: 1 addition & 4 deletions autoload/pmv/elixir/hexApi.vim
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function! pmv#elixir#hexApi#getPackageInfo(package)
if match(l:info, 'No package with name') != 0
return split(l:info, '\n')
else
call s:packageNotFound(a:package)
call pmv#utils#packageNotFound(a:package)
endif
endfunction

Expand All @@ -30,6 +30,3 @@ function! s:extractDate(str)
return l:date
endfunction

function! s:packageNotFound(package)
echom 'No package with name ' . a:package
endfunction
12 changes: 1 addition & 11 deletions autoload/pmv/elixir/hexUtils.vim
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ endfunction
function! pmv#elixir#hexUtils#getPackageName(qarg)
if empty(a:qarg)
let l:package = s:scanForPackage()
if s:packageNotFound(l:package)
if pmv#utils#packageNotFound(l:package)
return
endif
return l:package
Expand All @@ -53,13 +53,3 @@ function! s:scanForPackage()
let l:line = getline('.')
return matchstr(l:line, '{:\zs[a-z]\w*\ze')
endfunction

function! s:packageNotFound(package)
if empty(a:package)
redraw
echom 'No package found on this line!'
return 1
endif

return 0
endfunction
10 changes: 1 addition & 9 deletions autoload/pmv/nodejs/utils.vim
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function! pmv#nodejs#utils#getPackageName(qarg)
if empty(a:qarg)
let l:package = s:scanForPackage()
if s:packageNotFound(l:package)
if pmv#utils#packageNotFound(l:package)
return
endif
return l:package
Expand All @@ -20,14 +20,6 @@ function! s:scanForPackage()
endif
endfunction

function! s:packageNotFound(package)
if empty(a:package)
redraw
echom 'No package found on this line!'
return 1
endif
return 0
endfunction

function! pmv#nodejs#utils#getApiAllReleases(package)
let l:json = pmv#nodejs#utils#getApiPackage(a:package)
Expand Down
11 changes: 1 addition & 10 deletions autoload/pmv/rust/utils.vim
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function! pmv#rust#utils#getPackageName(qarg)
if empty(a:qarg)
let l:package = s:scanForPackage()
if s:packageNotFound(l:package)
if pmv#utils#packageNotFound(l:package)
return
endif
return l:package
Expand All @@ -20,15 +20,6 @@ function! s:scanForPackage()
endif
endfunction

function! s:packageNotFound(package)
if empty(a:package)
redraw
echom 'No package found on this line!'
return 1
endif
return 0
endfunction

function! pmv#rust#utils#getApiAllReleases(package)
let l:json = pmv#rust#utils#getApiPackage(a:package)
if has_key(l:json, 'versions')
Expand Down
9 changes: 9 additions & 0 deletions autoload/pmv/utils.vim
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ function! pmv#utils#renderPopup(input, ...)
nnoremap <silent> <buffer> q :bd<CR>
endfunction

function! pmv#utils#packageNotFound(package)
if empty(a:package)
redraw
echom '>>> No package found on this line! <<<'
return 1
endif
return 0
endfunction

function! pmv#utils#openUri(uri)
if s:is_macunix
call system('open ' . shellescape(a:uri))
Expand Down

0 comments on commit 7e662e4

Please sign in to comment.