Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Commit

Permalink
progress
Browse files Browse the repository at this point in the history
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
  • Loading branch information
kennethreitz committed Jan 12, 2018
1 parent e35c4af commit 23a41e1
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 10 deletions.
60 changes: 51 additions & 9 deletions pipenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,40 @@ def list_items(self):
def next_input(self, *args):
return None

# def placeholder(self):
# return "package-name"
def placeholder(self):
return "package-name"

def description(self, *args):
return "Package to install."


class UninstallHandler(sublime_plugin.ListInputHandler):
"""docstring for ClassName"""

def __init__(self):
super(InstallHandler, self).__init__()

def _return_packages(self):
home = os.path.basename(sublime.View().file_name())
print(sublime.current.file_name)

p = pipenvlib.PipenvProject(home)
return [p.name for p in (p.dev_packages + p.packages)]


def list_items(self):
return [p for p in self._return_packages()]

def next_input(self, *args):
return None

def placeholder(self):
return "package-name"

def description(self, *args):
return "Package to uninstall."


class pipenv_install(sublime_plugin.WindowCommand):
"""docstring for PipenvMenu"""

Expand All @@ -51,7 +78,7 @@ def description(self):
return "Pipenv is awesome"

def input(self, *args):
return InstallHandler()
return UninstallHandler()

def run(self, install_handler):
# The package to install.
Expand All @@ -65,15 +92,30 @@ def run(self, install_handler):
print(p._run('install {}', package))


class pipenv_uninstall(sublime_plugin.WindowCommand):
"""docstring for PipenvMenu"""

class ListPackagesCommand(sublime_plugin.WindowCommand):
def __init__(self, text):
super(pipenv_uninstall, self).__init__(text)

"""
A command that shows a list of all installed packages in the quick panel
"""
def is_enabled(self):
return True

def run(self):
ListPackagesThread(self.window).start()
def description(self):
return "Pipenv is awesome"

def input(self, *args):
return UninstallHandler()

def run(self, uninstall_handler=None):
# The package to install.
package = uninstall_handler

# The home directory for the current file name.
home = os.path.basename(sublime.Window.active_view(sublime.active_window()).file_name())

p = pipenvlib.PipenvProject(home)
print(p.packages + p.dev_packages)


if sublime.version() < '3000':
Expand Down
2 changes: 1 addition & 1 deletion pipenv.sublime-commands
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[
{ "caption": "Pipenv: Install Package", "command": "pipenv_install" },
{ "caption": "Pipenv: Uninstall Package", "command": "PipenvUninstall" }
{ "caption": "Pipenv: Uninstall Package", "command": "pipenv_uninstall" }
]

0 comments on commit 23a41e1

Please sign in to comment.