File: core.py

package info (click to toggle)
python-userpath 1.9.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 228 kB
  • sloc: python: 771; makefile: 21; sh: 16
file content (22 lines) | stat: -rw-r--r-- 1,029 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from .interface import Interface
from .utils import in_current_path


def prepend(location, app_name=None, shells=None, all_shells=False, home=None, check=False):
    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):
    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):
    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):
    interface = Interface(shells=shells, all_shells=all_shells, home=home)
    return not in_current_path(location) and interface.location_in_new_path(location)