-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3ffb82d
commit 20be070
Showing
1 changed file
with
4 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,29 @@ | ||
from .interface import Interface | ||
from .utils import in_current_path | ||
import os | ||
|
||
def prepend(location, app_name=None, shells=None, all_shells=False, home=None, check=False): | ||
if isinstance(location, os.PathLike): | ||
if hasattr(location, "__fspath__"): | ||
location = location.__fspath__() | ||
interface = Interface(shells=shells, all_shells=all_shells, home=home) | ||
return interface.put(location, front=True, app_name=app_name, check=check) | ||
|
||
|
||
def append(location, app_name=None, shells=None, all_shells=False, home=None, check=False): | ||
if isinstance(location, os.PathLike): | ||
if hasattr(location, "__fspath__"): | ||
location = location.__fspath__() | ||
interface = Interface(shells=shells, all_shells=all_shells, home=home) | ||
return interface.put(location, front=False, app_name=app_name, check=check) | ||
|
||
|
||
def in_new_path(location, shells=None, all_shells=False, home=None, check=False): | ||
if isinstance(location, os.PathLike): | ||
if hasattr(location, "__fspath__"): | ||
location = location.__fspath__() | ||
interface = Interface(shells=shells, all_shells=all_shells, home=home) | ||
return interface.location_in_new_path(location, check=check) | ||
|
||
|
||
def need_shell_restart(location, shells=None, all_shells=False, home=None): | ||
if isinstance(location, os.PathLike): | ||
if hasattr(location, "__fspath__"): | ||
location = location.__fspath__() | ||
interface = Interface(shells=shells, all_shells=all_shells, home=home) | ||
return not in_current_path(location) and interface.location_in_new_path(location) |