puntonim / promptastic Goto Github PK
View Code? Open in Web Editor NEWA fantastic prompt for Bash
Home Page: http://painl.es/promptastic/
License: Apache License 2.0
A fantastic prompt for Bash
Home Page: http://painl.es/promptastic/
License: Apache License 2.0
If you open the .git folder:
$ cd .git/hooks/
fatal: This operation must be run in a work tree
Errors are outputted in every executed command.
If I'm not wrong, promptastic works with bash. Are there plans to add fish support, as powerline-shell does? Thank you.
During installation ask the user if she wants to use Python 2 or 3.
The installation will automatically change the first line in promptastic.py:
#!/usr/bin/env python3
Performance could be improved if the configuration were hard-coded in promptastic.py
. Currently promptastic reads the configuration in config.py
to display the enabled segments with the chosen theme's colors. This could be done better this way:
promptastic.py
becomes a template, say promptastic.py.template
install.py
creates the actual promptastic.py
script out of that template by reading config.py
and injecting only the enabled segments with hard-coded colors.I have a problem, which I wasn't able to fix myself. If my directory i want to cd
in contains german umlauts, then I got the error mentioned in the title:
$ cd /Users/Martin/Dropbox/Entwicklung/Bstäpp
Traceback (most recent call last):
File "/Users/Martin/bin/promptastic/promptastic.py", line 186, in <module>
write(prompt.render())
File "/Users/Martin/bin/promptastic/promptastic.py", line 37, in render
first_line = self._render_first_line()
File "/Users/Martin/bin/promptastic/promptastic.py", line 65, in _render_first_line
output += segment.render()
UnicodeDecodeError: 'ascii' codec can't decode byte 0xcc in position 68: ordinal not in range(128)
Any idea where to encode de ascii-string in the promptastic.py? Thanks for your help!
Is Promptastic remembering the current directory when a new tab or window is opened? Or is it always putting the user on home?
Are there plans to add zsh support?
I am suddenly getthing this error whenever I am not in a directory of a git repo:
Traceback (most recent call last):
File "/home/rogermortis/dotfiles/bash/promptastic/segments/git.py", line 42, in get_branch_name
raise FileNotFoundError
NameError: global name 'FileNotFoundError' is not defined
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/rogermortis/promptastic/promptastic.py", line 164, in <module>
prompt.first_line_right.append(git.Git())
File "/home/rogermortis/dotfiles/bash/promptastic/segments/__init__.py", line 22, in __init__
self.init(*args, **kwargs)
File "/home/rogermortis/dotfiles/bash/promptastic/segments/git.py", line 11, in init
branch_name = self.get_branch_name()
File "/home/rogermortis/dotfiles/bash/promptastic/segments/git.py", line 43, in get_branch_name
except FileNotFoundError:
NameError: global name 'FileNotFoundError' is not defined
I don't think I changed anything...
I'm using Manjaro Linux (Arch Linux). Removed the power-line from ~/.bashrc and ran ./install.py with no config.py modification. ~/.bashrc and ~/.profile looks good as you can see in 2nd screenshot.
The prompt have no colors.
I'm using Konsole 2.14 and KDE 4.14.0.
Hello there!
I was using your wonderful project on my previous Ubuntu, with Unity (yeah, everyone does some mistakes...). The installation was good.
I have re-installed my computer from scratch yesterday with a Kubuntu 15.04. So, I'm using Konsole now as terminal emulator. I wanted to re-install your project too, but when I am starting the install.sh
file, it does nothing: no output.
I put the line export TERM=xterm-256color
in my bashrc file as you mentioned in your INSTALL.md.
clotaire@Boromir:~$ echo $TERM
xterm-256color
Here is what it does when I start install.py file:
clotaire@Boromir:~$ cd Projets/promptastic/
clotaire@Boromir:~/Projets/promptastic$ ./install.py
clotaire@Boromir:~/Projets/promptastic$
And then, Konsole is buggy, for example if I want to edit a file using vim in it after trying to install your project, it does this:
clotaire@Boromir:~/Projets/promptastic$ vim install.py
Vim : Alerte : La sortie ne s'effectue pas sur un terminal (translation: Warning: output is not to a terminal)
Any help is appreciate! Thanks for your time.
I think if you use python2.7.*, I will "love" you forever. 👍
With the default configuration on terminator, my prompt looks like the screenshot below.
Screenshot is of terminator, Konsole looks the same.
The configuration in my .bashrc
file is the following:
# Promptastic is assumed to be installed in $promptastic_home
promptastic_home=~/.local/opt/promptastic
function _update_ps1() {
PS1="$(${promptastic_home}/promptastic.py $?)"
export PS1
}
if [ -f "${promptastic_home}/promptastic.py" ]; then
export PROMPT_COMMAND="_update_ps1"
fi
My 'config.py` file is the following:
# This is the configuration file which helps you customize your 'promptastic' installation.
# For instructions on how to use the promptastic.py script, see the README.
# Patched fonts are special fonts best suited for terminals
# True if the current terminal is using patched fonts (available at:
# https://github.com/Lokaltog/powerline-fonts).
PATCHED_FONTS = True
# The theme defines the colors used to draw individual segments.
# Themes are collected in the `themes` directory. Their names match their file name (w/o the file
# extension .py).
THEME = 'default'
# Segments are the single elements which compose the Bash shell prompt.
# Enable or disable these segments to customize what you see on the shell prompt.
SEGMENTS = {
# Current user's username plus @ plus machine's hostname.
'userathost': True,
# SSH tag when ssh-ing from another machine.
'ssh': True,
# Current directory path.
'currentdir': True,
# A padlock if the current user has read-only permissions on the current directory.
'readonly': True,
# A cross if the last command exited with a non-zero exit code.
'exitcode': True,
# Current git branch and status when the current directory is part of a git repo.
'git': True,
# Name of the current virtual environment (see http://www.virtualenv.org/), if any.
'venv': True,
# Number of running jobs, if any.
'jobs': True,
# Current time.
'time': True,
}
The promptastic.py
file did I not change.
Googling the mistake and reading the documentation hasn't helped me.
Another suggestion for
INSTALL.md
, add a path to where theconfig.py
file will be stored. It is not mentioned here.
Whenever I open the Terminal, Gnome Terminal, I get a 'x' indicating a non-zero exit code. Why do I get this with a fresh Terminal?
Make Promptastic compatible with both Python 2 and 3.
Things to keep in mind:
I know this is probably not in your expected use cases, but I'm using Promptastic in Cygwin, which uses a stripped-down version of the ps command that doesn't have a -o option. As a result, the ps command in sysinfo.py: line 19 generates errors that appear every time a new prompt is displayed. It's only an annoyance, so I'd understand if this is low priority, but the fix seems like it would be simple. Just redirect stderr to /dev/null temporarily, perhaps?
In any case, I hope you might alter the relevant code to handle this case. If you need any further information on this issue, I'll be happy to respond.
Hi, awesome project! I just couldn't get Powerline's git plugin configured on my Ubuntu box and this works a charm!
OrderedDict
?).My Setup:
Aim 😄:
Let me know your thoughts, I might be able to hack on this project a bit 😉 🔨
After installing promptastic in Ubuntu, the graphical login is broken. The login screen keeps showing up even after a successful login.
The reason is that promptastic must be installed only in ~/.bashrc
and not in ~/.profile
.
hello,
would it suffice to replace objectswith identical file/folder names with powerline-shell? thanks~
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.