Skip to content

Commit

Permalink
Supported copying result to clipboard.
Browse files Browse the repository at this point in the history
  • Loading branch information
huntzhan committed Aug 20, 2016
1 parent fa34cf8 commit f3644fe
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ And the CLI is pretty simple:
```
$ img2url --help
Usage:
img2url <path>
img2url (-m | --markdown) <path>
img2url [--no-clipboard] <path>
img2url [--no-clipboard] (-m | --markdown) <path>
Options:
-m, --markdown
--no-clipboard Prevent copying result to clipboard.
-m, --markdown Return Markdown format of image url.
```

Example:
Expand Down
14 changes: 9 additions & 5 deletions img2url/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@
from future.builtins.disabled import * # noqa

from docopt import docopt
import pyperclip

from img2url.metadata import VERSION

from img2url.config import locate_config, load_config

from img2url.remotes.github import GitHubConfig, GitHubOperation
from img2url.remotes.qiniu import QiniuConfig, QiniuOperation


DOC = '''
Usage:
img2url <path>
img2url (-m | --markdown) <path>
img2url [--no-clipboard] <path>
img2url [--no-clipboard] (-m | --markdown) <path>
Options:
-m, --markdown
--no-clipboard Prevent copying result to clipboard.
-m, --markdown Return Markdown format of image url.
'''

CONFIG_REMOTE = 'remote'
Expand Down Expand Up @@ -104,4 +104,8 @@ def entry_point():
resource_url,
doc_type,
)

if not args['--no-clipboard']:
pyperclip.copy(url)

print(url)
2 changes: 1 addition & 1 deletion img2url/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


NAME = 'img2url'
VERSION = '0.1.6'
VERSION = '0.2.0'
AUTHORS = [
'huntzhan',
]
Expand Down
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ PyYAML
# enable proxy.
requests>=2.10.0
pysocks

docopt
pyperclip

qiniu

0 comments on commit f3644fe

Please sign in to comment.