Skip to content

Commit

Permalink
Bash Prompt - prevent breakage where PS1 isn't set
Browse files Browse the repository at this point in the history
  • Loading branch information
nathan-muir committed May 24, 2017
1 parent 72e60e7 commit 2645f76
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions nv/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,12 @@ def launch_shell(environment_name, project_dir):
'NV_PROJECT_DIR': project_dir,
'NV_ENVIRONMENT': nv_conf['environment_name'],
'NV_ENVIRONMENT_DIR': nv_dir,
# specify non-printing sequences (e.g. color codes) as non-printing, using \[...\]
'PS1': r'\[\e[01m\]{0[project_name]}:{0[environment_name]}\[\e[0m\] {1}'.format(nv_conf, os.environ['PS1']),
})
if 'PS1' in os.environ:
new_env.update({
# specify non-printing sequences (e.g. color codes) as non-printing, using \[...\]
'PS1': r'\[\e[01m\]{0[project_name]}:{0[environment_name]}\[\e[0m\] {1}'.format(nv_conf, os.environ['PS1']),
})
aws_profile = nv_conf.get('aws_profile')
if aws_profile:
session = boto3.Session(profile_name=aws_profile)
Expand Down

0 comments on commit 2645f76

Please sign in to comment.