mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-06 17:30:59 +01:00
add docstring for dynamic_pwd methods
This commit is contained in:
parent
19f24371f3
commit
22836da3dc
2 changed files with 16 additions and 0 deletions
|
@ -1025,6 +1025,12 @@ def _collapsed_pwd():
|
||||||
return leader + sep.join(base)
|
return leader + sep.join(base)
|
||||||
|
|
||||||
def _dynamically_collapsed_pwd():
|
def _dynamically_collapsed_pwd():
|
||||||
|
"""
|
||||||
|
Return the compact current working directory
|
||||||
|
|
||||||
|
It respects the environment variable DYNAMIC_CWD_WIDTH.
|
||||||
|
"""
|
||||||
|
|
||||||
sep = get_sep()
|
sep = get_sep()
|
||||||
originial_path = _replace_home_cwd()
|
originial_path = _replace_home_cwd()
|
||||||
pwd = originial_path.split(sep)
|
pwd = originial_path.split(sep)
|
||||||
|
|
|
@ -738,12 +738,19 @@ def is_history_tuple(x):
|
||||||
|
|
||||||
|
|
||||||
def is_dynamic_cwd_width(x):
|
def is_dynamic_cwd_width(x):
|
||||||
|
"""
|
||||||
|
Determine if the input is a valid input for the DYNAMIC_CWD_WIDTH
|
||||||
|
environement variable
|
||||||
|
"""
|
||||||
if x[-1] == '%':
|
if x[-1] == '%':
|
||||||
x = x[:-1]
|
x = x[:-1]
|
||||||
return x.isdigit()
|
return x.isdigit()
|
||||||
|
|
||||||
|
|
||||||
def to_dynamic_cwd_tuple(x):
|
def to_dynamic_cwd_tuple(x):
|
||||||
|
"""
|
||||||
|
Convert to a canonical cwd_width tuple
|
||||||
|
"""
|
||||||
unit = 'c'
|
unit = 'c'
|
||||||
if x[-1] == '%':
|
if x[-1] == '%':
|
||||||
x = x[:-1]
|
x = x[:-1]
|
||||||
|
@ -752,6 +759,9 @@ def to_dynamic_cwd_tuple(x):
|
||||||
|
|
||||||
|
|
||||||
def dynamic_cwd_tuple_to_str(x):
|
def dynamic_cwd_tuple_to_str(x):
|
||||||
|
"""
|
||||||
|
Convert a canonical cwd_width tuple to a string
|
||||||
|
"""
|
||||||
if x[1] == '%':
|
if x[1] == '%':
|
||||||
return str(x[0]) + '%'
|
return str(x[0]) + '%'
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Reference in a new issue