pax_global_header 0000666 0000000 0000000 00000000064 14634027167 0014524 g ustar 00root root 0000000 0000000 52 comment=059f7f230760f8800307b3ae632c6cc6ca3f81d4
powerline-go-1.25/ 0000775 0000000 0000000 00000000000 14634027167 0014062 5 ustar 00root root 0000000 0000000 powerline-go-1.25/.editorconfig 0000664 0000000 0000000 00000000232 14634027167 0016534 0 ustar 00root root 0000000 0000000 # See http://editorconfig.org
# In Go files we indent with tabs but still
# set indent_size to control the GitHub web viewer.
[*.go]
indent_size = 4
powerline-go-1.25/.github/ 0000775 0000000 0000000 00000000000 14634027167 0015422 5 ustar 00root root 0000000 0000000 powerline-go-1.25/.github/ISSUE_TEMPLATE/ 0000775 0000000 0000000 00000000000 14634027167 0017605 5 ustar 00root root 0000000 0000000 powerline-go-1.25/.github/ISSUE_TEMPLATE/bug_report.md 0000664 0000000 0000000 00000001225 14634027167 0022277 0 ustar 00root root 0000000 0000000 ---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Environment (please complete the following information):**
- OS: [e.g. linux]
- Architecture: [e.g. intel, arm, if you don’t know this leave it empty]
- Shell: [e.g. zsh, bash, fish, powershell]
**Additional context**
Add any other context about the problem here.
powerline-go-1.25/.github/ISSUE_TEMPLATE/feature_request.md 0000664 0000000 0000000 00000001134 14634027167 0023331 0 ustar 00root root 0000000 0000000 ---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
powerline-go-1.25/.github/workflows/ 0000775 0000000 0000000 00000000000 14634027167 0017457 5 ustar 00root root 0000000 0000000 powerline-go-1.25/.github/workflows/build.yml 0000664 0000000 0000000 00000001123 14634027167 0021276 0 ustar 00root root 0000000 0000000 name: Build
on:
pull_request: {}
merge_group:
types: [checks_requested]
push: {}
jobs:
build:
runs-on: ubuntu-latest
name: Build binaries
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- run: git fetch --force --tags
- uses: actions/setup-go@v4
with:
go-version: "1.20"
- uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
args: build --clean --snapshot
- run: dist/powerline-go_linux_amd64_v1/powerline-go --help
powerline-go-1.25/.github/workflows/release.yml 0000664 0000000 0000000 00000001066 14634027167 0021625 0 ustar 00root root 0000000 0000000 name: Release
on:
push:
tags:
- v*
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
name: Release binaries
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- run: git fetch --force --tags
- uses: actions/setup-go@v4
with:
go-version: "1.20"
- uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
powerline-go-1.25/.gitignore 0000664 0000000 0000000 00000000472 14634027167 0016055 0 ustar 00root root 0000000 0000000 # Binaries for programs and plugins
*.exe
*.dll
*.so
*.dylib
powerline-go
/dist/
# Test binary, build with `go test -c`
*.test
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736
.glide/
/.idea/
.vscode/
powerline-go-1.25/.goreleaser.yaml 0000664 0000000 0000000 00000001155 14634027167 0017156 0 ustar 00root root 0000000 0000000 project_name: powerline-go
before:
hooks:
- go mod download
builds:
- binary: powerline-go
env:
- CGO_ENABLED=0
goarch:
- amd64
- arm
- arm64
- "386"
goos:
- darwin
- linux
- windows
- freebsd
- netbsd
- openbsd
ignore:
- goos: darwin
goarch: "386"
- goos: openbsd
goarch: arm
flags:
- -trimpath
ldflags:
- -s
- -w
archives:
- name_template: "{{ .ProjectName }}-{{ .Os }}-{{ .Arch }}"
format: binary
checksum:
name_template: checksums.txt
changelog:
use: github
powerline-go-1.25/LICENSE.md 0000664 0000000 0000000 00000076704 14634027167 0015504 0 ustar 00root root 0000000 0000000 ### GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
### Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom
to share and change all versions of a program--to make sure it remains
free software for all its users. We, the Free Software Foundation, use
the GNU General Public License for most of our software; it applies
also to any other work released this way by its authors. You can apply
it to your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you
have certain responsibilities if you distribute copies of the
software, or if you modify it: responsibilities to respect the freedom
of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the
manufacturer can do so. This is fundamentally incompatible with the
aim of protecting users' freedom to change the software. The
systematic pattern of such abuse occurs in the area of products for
individuals to use, which is precisely where it is most unacceptable.
Therefore, we have designed this version of the GPL to prohibit the
practice for those products. If such problems arise substantially in
other domains, we stand ready to extend this provision to those
domains in future versions of the GPL, as needed to protect the
freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish
to avoid the special danger that patents applied to a free program
could make it effectively proprietary. To prevent this, the GPL
assures that patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
### TERMS AND CONDITIONS
#### 0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds
of works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of
an exact copy. The resulting work is called a "modified version" of
the earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user
through a computer network, with no transfer of a copy, is not
conveying.
An interactive user interface displays "Appropriate Legal Notices" to
the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
#### 1. Source Code.
The "source code" for a work means the preferred form of the work for
making modifications to it. "Object code" means any non-source form of
a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users can
regenerate automatically from other parts of the Corresponding Source.
The Corresponding Source for a work in source code form is that same
work.
#### 2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not convey,
without conditions so long as your license otherwise remains in force.
You may convey covered works to others for the sole purpose of having
them make modifications exclusively for you, or provide you with
facilities for running those works, provided that you comply with the
terms of this License in conveying all material for which you do not
control copyright. Those thus making or running the covered works for
you must do so exclusively on your behalf, under your direction and
control, on terms that prohibit them from making any copies of your
copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under the
conditions stated below. Sublicensing is not allowed; section 10 makes
it unnecessary.
#### 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such
circumvention is effected by exercising rights under this License with
respect to the covered work, and you disclaim any intention to limit
operation or modification of the work as a means of enforcing, against
the work's users, your or third parties' legal rights to forbid
circumvention of technological measures.
#### 4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
#### 5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these
conditions:
- a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
- b) The work must carry prominent notices stating that it is
released under this License and any conditions added under
section 7. This requirement modifies the requirement in section 4
to "keep intact all notices".
- c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
- d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
#### 6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms of
sections 4 and 5, provided that you also convey the machine-readable
Corresponding Source under the terms of this License, in one of these
ways:
- a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
- b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the Corresponding
Source from a network server at no charge.
- c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
- d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
- e) Convey the object code using peer-to-peer transmission,
provided you inform other peers where the object code and
Corresponding Source of the work are being offered to the general
public at no charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal,
family, or household purposes, or (2) anything designed or sold for
incorporation into a dwelling. In determining whether a product is a
consumer product, doubtful cases shall be resolved in favor of
coverage. For a particular product received by a particular user,
"normally used" refers to a typical or common use of that class of
product, regardless of the status of the particular user or of the way
in which the particular user actually uses, or expects or is expected
to use, the product. A product is a consumer product regardless of
whether the product has substantial commercial, industrial or
non-consumer uses, unless such uses represent the only significant
mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to
install and execute modified versions of a covered work in that User
Product from a modified version of its Corresponding Source. The
information must suffice to ensure that the continued functioning of
the modified object code is in no case prevented or interfered with
solely because modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or
updates for a work that has been modified or installed by the
recipient, or for the User Product in which it has been modified or
installed. Access to a network may be denied when the modification
itself materially and adversely affects the operation of the network
or violates the rules and protocols for communication across the
network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
#### 7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders
of that material) supplement the terms of this License with terms:
- a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
- b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
- c) Prohibiting misrepresentation of the origin of that material,
or requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
- d) Limiting the use for publicity purposes of names of licensors
or authors of the material; or
- e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
- f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions
of it) with contractual assumptions of liability to the recipient,
for any liability that these contractual assumptions directly
impose on those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions; the
above requirements apply either way.
#### 8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your license
from a particular copyright holder is reinstated (a) provisionally,
unless and until the copyright holder explicitly and finally
terminates your license, and (b) permanently, if the copyright holder
fails to notify you of the violation by some reasonable means prior to
60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
#### 9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or run
a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
#### 10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
#### 11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims owned
or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within the
scope of its coverage, prohibits the exercise of, or is conditioned on
the non-exercise of one or more of the rights that are specifically
granted under this License. You may not convey a covered work if you
are a party to an arrangement with a third party that is in the
business of distributing software, under which you make payment to the
third party based on the extent of your activity of conveying the
work, and under which the third party grants, to any of the parties
who would receive the covered work from you, a discriminatory patent
license (a) in connection with copies of the covered work conveyed by
you (or copies made from those copies), or (b) primarily for and in
connection with specific products or compilations that contain the
covered work, unless you entered into that arrangement, or that patent
license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
#### 12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under
this License and any other pertinent obligations, then as a
consequence you may not convey it at all. For example, if you agree to
terms that obligate you to collect a royalty for further conveying
from those to whom you convey the Program, the only way you could
satisfy both those terms and this License would be to refrain entirely
from conveying the Program.
#### 13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
#### 14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions
of the GNU General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in
detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies that a certain numbered version of the GNU General Public
License "or any later version" applies to it, you have the option of
following the terms and conditions either of that numbered version or
of any later version published by the Free Software Foundation. If the
Program does not specify a version number of the GNU General Public
License, you may choose any version ever published by the Free
Software Foundation.
If the Program specifies that a proxy can decide which future versions
of the GNU General Public License can be used, that proxy's public
statement of acceptance of a version permanently authorizes you to
choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
#### 15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT
WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE
DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
CORRECTION.
#### 16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR
CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT
NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR
LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM
TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
#### 17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
powerline-go-1.25/README.md 0000664 0000000 0000000 00000040242 14634027167 0015343 0 ustar 00root root 0000000 0000000 # A Powerline style prompt for your shell
A [Powerline](https://github.com/Lokaltog/vim-powerline) like prompt for Bash,
ZSH and Fish. Based on [Powerline-Shell](https://github.com/banga/powerline-shell) by @banga.
Ported to golang by @justjanne.

- Shows some important details about the git/hg branch (see below)
- Changes color if the last command exited with a failure code
- If you're too deep into a directory tree, shortens the displayed path with an ellipsis
- Shows the current Python [virtualenv](http://www.virtualenv.org/) environment
- Shows the current Ruby version using [rbenv](https://github.com/rbenv/rbenv) or [rvm](https://rvm.io/)
- Shows if you are in a [nix](https://nixos.org/) shell
- It's easy to customize and extend. See below for details.
**Table of Contents**
- [Version Control](#version-control)
- [Installation](#installation)
- [Precompiled Binaries](#precompiled-binaries)
- [Other Platforms](#other-platforms)
- [Bash](#bash)
- [ZSH](#zsh)
- [Fish](#fish)
- [Nix](#nix)
- [PowerShell](#powershell)
- [Customization](#customization)
- [License](#license)
## Version Control
All of the version control systems supported by powerline shell give you a
quick look into the state of your repo:
- The current branch is displayed and changes background color when the
branch is dirty.
- When the local branch differs from the remote, the difference in number
of commits is shown along with `⇡` or `⇣` indicating whether a git push
or pull is pending
In addition, git has a few extra symbols:
- `✎` -- a file has been modified, but not staged for commit
- `✔` -- a file is staged for commit
- `✼` -- a file has conflicts
- `+` -- untracked files are present
- `⚑` -- stash is present
Each of these will have a number next to it if more than one file matches.
## Installation
Requires Go 1.15+
`powerline-go` uses ANSI color codes, these should nowadays work everywhere,
but you may have to set your $TERM to `xterm-256color` for it to work.
If you want to use the "patched" mode (which is the default, and provides
improved UI), you'll need to install a powerline font, either as fallback,
or by patching the font you use for your terminal: see
[powerline-fonts](https://github.com/Lokaltog/powerline-fonts).
Alternatively you can use "compatible" or "flat" mode.
### Precompiled Binaries
I provide precompiled binaries for x64 Linux and macOS in the
[releases tab](https://github.com/justjanne/powerline-go/releases)
### Other Platforms
- Install (and update) the package with
```bash
go install github.com/justjanne/powerline-go@latest
```
- By default it will be in `$GOPATH/bin`, if you want to change that, you can set
your `$GOPATH` and/or `$GOBIN`, but will need to change the path in the
following scripts, too.
### Bash
Add the following to your `.bashrc`:
```bash
function _update_ps1() {
PS1="$($GOPATH/bin/powerline-go -error $? -jobs $(jobs -p | wc -l))"
# Uncomment the following line to automatically clear errors after showing
# them once. This not only clears the error for powerline-go, but also for
# everything else you run in that shell. Don't enable this if you're not
# sure this is what you want.
#set "?"
}
if [ "$TERM" != "linux" ] && [ -f "$GOPATH/bin/powerline-go" ]; then
PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
fi
```
Currently, right prompt support is not available when using bash.
### ZSH
Add the following to your `.zshrc`:
```bash
function powerline_precmd() {
PS1="$($GOPATH/bin/powerline-go -error $? -jobs ${${(%):%j}:-0})"
# Uncomment the following line to automatically clear errors after showing
# them once. This not only clears the error for powerline-go, but also for
# everything else you run in that shell. Don't enable this if you're not
# sure this is what you want.
#set "?"
}
function install_powerline_precmd() {
for s in "${precmd_functions[@]}"; do
if [ "$s" = "powerline_precmd" ]; then
return
fi
done
precmd_functions+=(powerline_precmd)
}
if [ "$TERM" != "linux" ] && [ -f "$GOPATH/bin/powerline-go" ]; then
install_powerline_precmd
fi
```
### Fish
Redefine `fish_prompt` in `~/.config/fish/config.fish`:
```bash
function fish_prompt
eval $GOPATH/bin/powerline-go -error $status -jobs (count (jobs -p))
end
```
### Nix
When using `nix-shell --pure`, `powerline-go` will not be accessible, and
your prompt will disappear.
To work around this you can add this snippet to your `.bashrc`,
which should re-enable the prompt in most cases:
```bash
# Workaround for nix-shell --pure
if [ "$IN_NIX_SHELL" == "pure" ]; then
if [ -x "$HOME/.nix-profile/bin/powerline-go" ]; then
alias powerline-go="$HOME/.nix-profile/bin/powerline-go"
elif [ -x "/run/current-system/sw/bin/powerline-go" ]; then
alias powerline-go="/run/current-system/sw/bin/powerline-go"
fi
fi
```
### Powershell
Redefine `prompt` function on your profile:
```powershell
# Load powerline-go prompt
function global:prompt {
$pwd = $ExecutionContext.SessionState.Path.CurrentLocation
$startInfo = New-Object System.Diagnostics.ProcessStartInfo
$startInfo.FileName = "powerline-go"
$startInfo.Arguments = "-shell bare"
$startInfo.Environment["TERM"] = "xterm-256color"
$startInfo.CreateNoWindow = $true
$startInfo.StandardOutputEncoding = [System.Text.Encoding]::UTF8
$startInfo.RedirectStandardOutput = $true
$startInfo.UseShellExecute = $false
$startInfo.WorkingDirectory = $pwd
$process = New-Object System.Diagnostics.Process
$process.StartInfo = $startInfo
$process.Start() | Out-Null
$standardOut = $process.StandardOutput.ReadToEnd()
$process.WaitForExit()
$standardOut
}
```
Use `ProcessStartInfo` is needed to allow fill the enviromnet variables required by powerline-go.
## Customization
There are a few optional arguments which can be seen by running
`powerline-go -help`. These can be used by changing the command you have set
in your shell’s init file.
```
Usage of powerline-go:
-alternate-ssh-icon
Show the older, original icon for SSH connections
-colorize-hostname
Colorize the hostname based on a hash of itself, or use the PLGO_HOSTNAMEFG and PLGO_HOSTNAMEBG env vars (both need to be set).
-condensed
Remove spacing between segments
-cwd-max-depth int
Maximum number of directories to show in path
(default 5)
-cwd-max-dir-size int
Maximum number of letters displayed for each directory in the path
(default -1)
-cwd-mode string
How to display the current directory
(valid choices: fancy, semifancy, plain, dironly)
(default "fancy")
-duration string
The elapsed clock-time of the previous command
-duration-min string
The minimal time a command has to take before the duration segment is shown (default "0")
-east-asian-width
Use East Asian Ambiguous Widths
-error int
Exit code of previously executed command
-eval
Output prompt in 'eval' format.
-git-assume-unchanged-size int
Disable checking for changed/edited files in git repositories where the index is larger than this size (in KB), improves performance (default 2048)
-git-disable-stats string
Comma-separated list to disable individual git statuses
(valid choices: ahead, behind, staged, notStaged, untracked, conflicted, stashed)
-git-mode string
How to display git status
(valid choices: fancy, compact, simple)
(default "fancy")
-hostname-only-if-ssh
Show hostname only for SSH connections
-ignore-repos string
A list of git repos to ignore. Separate with ','.
Repos are identified by their root directory.
-ignore-warnings
Ignores all warnings regarding unset or broken variables
-jobs int
Number of jobs currently running
-max-width int
Maximum width of the shell that the prompt may use, in percent. Setting this to 0 disables the shrinking subsystem.
-mode string
The characters used to make separators between segments.
(valid choices: patched, compatible, flat)
(default "patched")
-modules string
The list of modules to load, separated by ','
(valid choices: aws, bzr, cwd, direnv, docker, docker-context, dotenv, duration, exit, fossil, gcp, git, gitlite, goenv, hg, host, jobs, kube, load, newline, nix-shell, node, perlbrew, perms, plenv, rbenv, root, rvm, shell-var, shenv, ssh, svn, termtitle, terraform-workspace, time, user, venv, vgo, vi-mode, wsl)
Unrecognized modules will be invoked as 'powerline-go-MODULE' executable plugins and should output a (possibly empty) list of JSON objects that unmarshal to powerline-go's Segment structs.
(default "venv,user,host,ssh,cwd,perms,git,hg,jobs,exit,root")
-modules-right string
The list of modules to load anchored to the right, for shells that support it, separated by ','
(valid choices: aws, bzr, cwd, direnv, docker, docker-context, dotenv, duration, exit, fossil, gcp, git, gitlite, goenv, hg, host, jobs, kube, load, newline, nix-shell, node, perlbrew, perms, plenv, rbenv, root, rvm, shell-var, shenv, ssh, svn, termtitle, terraform-workspace, time, user, venv, vgo, wsl)
Unrecognized modules will be invoked as 'powerline-go-MODULE' executable plugins and should output a (possibly empty) list of JSON objects that unmarshal to powerline-go's Segment structs.
-newline
Show the prompt on a new line
-numeric-exit-codes
Shows numeric exit codes for errors.
-path-aliases string
One or more aliases from a path to a short name. Separate with ','.
An alias maps a path like foo/bar/baz to a short name like FBB.
Specify these as key/value pairs like foo/bar/baz=FBB.
Use '~' for your home dir. You may need to escape this character to avoid shell substitution.
-priority string
Segments sorted by priority, if not enough space exists, the least priorized segments are removed first. Separate with ','
(valid choices: aws, bzr, cwd, direnv, docker, docker-context, dotenv, duration, exit, fossil, gcp, git, gitlite, goenv, hg, host, jobs, kube, load, newline, nix-shell, node, perlbrew, perms, plenv, rbenv, root, rvm, shell-var, shenv, ssh, svn, termtitle, terraform-workspace, time, user, venv, vgo, vi-mode, wsl)
(default "root,cwd,user,host,ssh,perms,git-branch,git-status,hg,jobs,exit,cwd-path")
-shell string
Set this to your shell type
(valid choices: autodetect, bare, bash, zsh)
(default "autodetect")
-shell-var string
A shell variable to add to the segments.
-shell-var-no-warn-empty
Disables warning for empty shell variable.
-shorten-eks-names
Shortens names for EKS Kube clusters.
-shorten-gke-names
Shortens names for GKE Kube clusters.
-static-prompt-indicator
Always show the prompt indicator with the default color, never with the error color
-theme string
Set this to the theme you want to use
(valid choices: default, low-contrast, gruvbox, solarized-dark16, solarized-light16)
(default "default")
-trim-ad-domain
Trim the Domainname from the AD username.
-truncate-segment-width int
Maximum width of a segment, segments longer than this will be shortened if space is limited. Setting this to 0 disables it.
(default 16)
-venv-name-size-limit int
Show indicator instead of virtualenv name if name is longer than this limit (defaults to 0, which is unlimited)
-vi-mode string
The current vi-mode (eg. KEYMAP for zsh) for vi-module module
```
### Eval
If using `eval` and `-modules-right` is desired, the shell setup must be modified slightly, as shown below:
##### Bash
Add the following to your `.bashrc`:
```bash
function _update_ps1() {
eval "$($GOPATH/bin/powerline-go -error $? -shell bash -eval -modules-right git)"
}
if [ "$TERM" != "linux" ] && [ -f "$GOPATH/bin/powerline-go" ]; then
PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
fi
```
##### ZSH
Add the following to your `.zshrc`:
```bash
function powerline_precmd() {
eval "$($GOPATH/bin/powerline-go -error $? -shell zsh -eval -modules-right git)"
}
function install_powerline_precmd() {
for s in "${precmd_functions[@]}"; do
if [ "$s" = "powerline_precmd" ]; then
return
fi
done
precmd_functions+=(powerline_precmd)
}
if [ "$TERM" != "linux" ]; then
install_powerline_precmd
fi
```
##### Fish
Eval mode (and `modules-right` support) for Fish is not currently available.
### Path Aliases
The point of the path aliases feature is to allow you to replace long paths
with a shorter string that you can understand more quickly. This is useful if
you're often in deep path hierarchies that end up consuming most of your
terminal width, even when some portions are replaced by an ellipsis.
For example, you might want to replace the string `$GOPATH/src/github.com` with
`@GOPATH-GH`. When you're in a directory like
`$GOPATH/src/github.com/justjanne/powerline-go`, you'll instead see `@GOPATH-GH >
justjanne > powerline-go` in the shell prompt.
Aliases are defined as comma-separated key value pairs, like this:
```bash
powerline-go ... -path-aliases \$GOPATH/src/github.com=@GOPATH-GH,\~/work/projects/foo=@FOO,\~/work/projects/bar=@BAR
```
Note that you should use `~` instead of `/home/username` when specifying the
path. Also make sure to escape the `~` character. Otherwise your shell will
perform interpolation on it before `powerline-go` can see it!
### Duration
The duration segment requires some assistance from the shell. The shell must have a hook that gets executed immediately before the command.
#### Bash
Bash 4.4 includes an easy way to get a start-time, using `$PS0`. However, not all operating systems come with a sufficiently recent version of Bash installed. This example only has seconds precision. Add or modify your `.bashrc` file to include the following:
```bash
INTERACTIVE_BASHPID_TIMER="/tmp/${USER}.START.$$"
PS0='$(echo $SECONDS > "$INTERACTIVE_BASHPID_TIMER")'
function _update_ps1() {
local __ERRCODE=$?
local __DURATION=0
if [ -e $INTERACTIVE_BASHPID_TIMER ]; then
local __END=$SECONDS
local __START=$(cat "$INTERACTIVE_BASHPID_TIMER")
__DURATION="$(($__END - ${__START:-__END}))"
rm -f "$INTERACTIVE_BASHPID_TIMER"
fi
PS1="$($GOPATH/bin/powerline-go -modules duration -duration $__DURATION -error $__ERRCODE -shell bash)"
}
if [ "$TERM" != "linux" ] && [ -f "$GOPATH/bin/powerline-go" ]; then
PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
fi
```
#### Zsh
Using `$EPOCHREALTIME` requires loading the 'datetime' module in your `.zshrc` file, for example:
```bash
zmodload zsh/datetime
function preexec() {
__TIMER=$EPOCHREALTIME
}
function powerline_precmd() {
local __ERRCODE=$?
local __DURATION=0
if [ -n $__TIMER ]; then
local __ERT=$EPOCHREALTIME
__DURATION="$(($__ERT - ${__TIMER:-__ERT}))"
fi
PS1="$(powerline-go -modules duration -duration $__DURATION -error $__ERRCODE -shell zsh)"
unset __TIMER
}
```
If the 'datetime' module is unavailable or unwanted, you may replace `$EPOCHREALTIME` with `$SECONDS`, at the loss of precision.
#### Fish
The fish prompt, in `~/.config/fish/config.fish`, will require a minimum of changes, as Fish automatically provides `$CMD_DURATION`, although with only milliseconds accuracy.
```bash
function fish_prompt
set duration (math -s6 "$CMD_DURATION / 1000")
$GOPATH/bin/powerline-go -modules duration -duration $duration -error $status -shell bare
end
```
## License
> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
>
> This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
>
> You should have received a copy of the GNU General Public License along with this program. If not, see .
powerline-go-1.25/args.go 0000664 0000000 0000000 00000022526 14634027167 0015354 0 ustar 00root root 0000000 0000000 package main
import (
"flag"
"strings"
)
type arguments struct {
CwdMode *string
CwdMaxDepth *int
CwdMaxDirSize *int
ColorizeHostname *bool
HostnameOnlyIfSSH *bool
SshAlternateIcon *bool
EastAsianWidth *bool
PromptOnNewLine *bool
StaticPromptIndicator *bool
VenvNameSizeLimit *int
GitAssumeUnchangedSize *int64
GitDisableStats *string
GitMode *string
Jobs *int
Mode *string
Theme *string
Shell *string
Modules *string
ModulesRight *string
Priority *string
MaxWidthPercentage *int
TruncateSegmentWidth *int
PrevError *int
NumericExitCodes *bool
IgnoreRepos *string
ShortenGKENames *bool
ShortenEKSNames *bool
ShortenOpenshiftNames *bool
ShellVar *string
ShellVarNoWarnEmpty *bool
TrimADDomain *bool
PathAliases *string
Duration *string
DurationMin *string
DurationLowPrecision *bool
Eval *bool
Condensed *bool
IgnoreWarnings *bool
Time *string
ViMode *string
}
var args = arguments{
CwdMode: flag.String(
"cwd-mode",
defaults.CwdMode,
commentsWithDefaults("How to display the current directory",
"(valid choices: fancy, semifancy, plain, dironly)")),
CwdMaxDepth: flag.Int(
"cwd-max-depth",
defaults.CwdMaxDepth,
commentsWithDefaults("Maximum number of directories to show in path")),
CwdMaxDirSize: flag.Int(
"cwd-max-dir-size",
defaults.CwdMaxDirSize,
commentsWithDefaults("Maximum number of letters displayed for each directory in the path")),
ColorizeHostname: flag.Bool(
"colorize-hostname",
defaults.ColorizeHostname,
comments("Colorize the hostname based on a hash of itself, or use the PLGO_HOSTNAMEFG and PLGO_HOSTNAMEBG env vars (both need to be set).")),
HostnameOnlyIfSSH: flag.Bool(
"hostname-only-if-ssh",
defaults.HostnameOnlyIfSSH,
comments("Show hostname only for SSH connections")),
SshAlternateIcon: flag.Bool(
"alternate-ssh-icon",
defaults.SshAlternateIcon,
comments("Show the older, original icon for SSH connections")),
EastAsianWidth: flag.Bool(
"east-asian-width",
defaults.EastAsianWidth,
comments("Use East Asian Ambiguous Widths")),
PromptOnNewLine: flag.Bool(
"newline",
defaults.PromptOnNewLine,
comments("Show the prompt on a new line")),
StaticPromptIndicator: flag.Bool(
"static-prompt-indicator",
defaults.StaticPromptIndicator,
comments("Always show the prompt indicator with the default color, never with the error color")),
VenvNameSizeLimit: flag.Int(
"venv-name-size-limit",
defaults.VenvNameSizeLimit,
comments("Show indicator instead of virtualenv name if name is longer than this limit (defaults to 0, which is unlimited)")),
Jobs: flag.Int(
"jobs",
defaults.Jobs,
comments("Number of jobs currently running")),
GitAssumeUnchangedSize: flag.Int64(
"git-assume-unchanged-size",
defaults.GitAssumeUnchangedSize,
comments("Disable checking for changed/edited files in git repositories where the index is larger than this size (in KB), improves performance")),
GitDisableStats: flag.String(
"git-disable-stats",
strings.Join(defaults.GitDisableStats, ","),
commentsWithDefaults("Comma-separated list to disable individual git statuses",
"(valid choices: ahead, behind, staged, notStaged, untracked, conflicted, stashed)")),
GitMode: flag.String(
"git-mode",
defaults.GitMode,
commentsWithDefaults("How to display git status",
"(valid choices: fancy, compact, simple)")),
Mode: flag.String(
"mode",
defaults.Mode,
commentsWithDefaults("The characters used to make separators between segments.",
"(valid choices: patched, compatible, flat)")),
Theme: flag.String(
"theme",
defaults.Theme,
commentsWithDefaults("Set this to the theme you want to use",
"(valid choices: default, low-contrast, gruvbox, solarized-dark16, solarized-light16)")),
Shell: flag.String(
"shell",
defaults.Shell,
commentsWithDefaults("Set this to your shell type",
"(valid choices: autodetect, bare, bash, zsh)")),
Modules: flag.String(
"modules",
strings.Join(defaults.Modules, ","),
commentsWithDefaults("The list of modules to load, separated by ','",
"(valid choices: aws, bzr, cwd, direnv, docker, docker-context, dotenv, duration, exit, fossil, gcp, git, gitlite, goenv, hg, host, jobs, kube, load, newline, nix-shell, node, perlbrew, perms, plenv, rbenv, root, rvm, shell-var, shenv, ssh, svn, termtitle, terraform-workspace, time, user, venv, vgo, vi-mode, wsl)",
"Unrecognized modules will be invoked as 'powerline-go-MODULE' executable plugins and should output a (possibly empty) list of JSON objects that unmarshal to powerline-go's Segment structs.")),
ModulesRight: flag.String(
"modules-right",
strings.Join(defaults.ModulesRight, ","),
comments("The list of modules to load anchored to the right, for shells that support it, separated by ','",
"(valid choices: aws, bzr, cwd, direnv, docker, docker-context, dotenv, duration, exit, fossil, gcp, git, gitlite, goenv, hg, host, jobs, kube, load, newline, nix-shell, node, perlbrew, perms, plenv, rbenv, root, rvm, shell-var, shenv, ssh, svn, termtitle, terraform-workspace, time, user, venv, vgo, wsl)",
"Unrecognized modules will be invoked as 'powerline-go-MODULE' executable plugins and should output a (possibly empty) list of JSON objects that unmarshal to powerline-go's Segment structs.")),
Priority: flag.String(
"priority",
strings.Join(defaults.Priority, ","),
commentsWithDefaults("Segments sorted by priority, if not enough space exists, the least priorized segments are removed first. Separate with ','",
"(valid choices: aws, bzr, cwd, direnv, docker, docker-context, dotenv, duration, exit, fossil, gcp, git, gitlite, goenv, hg, host, jobs, kube, load, newline, nix-shell, node, perlbrew, perms, plenv, rbenv, root, rvm, shell-var, shenv, ssh, svn, termtitle, terraform-workspace, time, user, venv, vgo, vi-mode, wsl)")),
MaxWidthPercentage: flag.Int(
"max-width",
defaults.MaxWidthPercentage,
comments("Maximum width of the shell that the prompt may use, in percent. Setting this to 0 disables the shrinking subsystem.")),
TruncateSegmentWidth: flag.Int(
"truncate-segment-width",
defaults.TruncateSegmentWidth,
commentsWithDefaults("Maximum width of a segment, segments longer than this will be shortened if space is limited. Setting this to 0 disables it.")),
PrevError: flag.Int(
"error",
defaults.PrevError,
comments("Exit code of previously executed command")),
NumericExitCodes: flag.Bool(
"numeric-exit-codes",
defaults.NumericExitCodes,
comments("Shows numeric exit codes for errors.")),
IgnoreRepos: flag.String(
"ignore-repos",
strings.Join(defaults.IgnoreRepos, ","),
comments("A list of git repos to ignore. Separate with ','.",
"Repos are identified by their root directory.")),
ShortenGKENames: flag.Bool(
"shorten-gke-names",
defaults.ShortenGKENames,
comments("Shortens names for GKE Kube clusters.")),
ShortenEKSNames: flag.Bool(
"shorten-eks-names",
defaults.ShortenEKSNames,
comments("Shortens names for EKS Kube clusters.")),
ShortenOpenshiftNames: flag.Bool(
"shorten-openshift-names",
defaults.ShortenOpenshiftNames,
comments("Shortens names for Openshift Kube clusters.")),
ShellVar: flag.String(
"shell-var",
defaults.ShellVar,
comments("A shell variable to add to the segments.")),
ShellVarNoWarnEmpty: flag.Bool(
"shell-var-no-warn-empty",
defaults.ShellVarNoWarnEmpty,
comments("Disables warning for empty shell variable.")),
TrimADDomain: flag.Bool(
"trim-ad-domain",
defaults.TrimADDomain,
comments("Trim the Domainname from the AD username.")),
PathAliases: flag.String(
"path-aliases",
"",
comments("One or more aliases from a path to a short name. Separate with ','.",
"An alias maps a path like foo/bar/baz to a short name like FBB.",
"Specify these as key/value pairs like foo/bar/baz=FBB.",
"Use '~' for your home dir. You may need to escape this character to avoid shell substitution.")),
Duration: flag.String(
"duration",
defaults.Duration,
comments("The elapsed clock-time of the previous command")),
Time: flag.String(
"time",
defaults.Time,
comments("The layout string how a reference time should be represented.",
"The reference time is predefined and not user choosen.",
"Consult the golang documentation for details: https://pkg.go.dev/time#example-Time.Format")),
DurationMin: flag.String(
"duration-min",
defaults.DurationMin,
comments("The minimal time a command has to take before the duration segment is shown")),
DurationLowPrecision: flag.Bool(
"duration-low-precision",
defaults.DurationLowPrecision,
comments("Use low precision timing for duration with milliseconds as maximum resolution")),
Eval: flag.Bool(
"eval",
defaults.Eval,
comments("Output prompt in 'eval' format.")),
Condensed: flag.Bool(
"condensed",
defaults.Condensed,
comments("Remove spacing between segments")),
IgnoreWarnings: flag.Bool(
"ignore-warnings",
defaults.IgnoreWarnings,
comments("Ignores all warnings regarding unset or broken variables")),
ViMode: flag.String(
"vi-mode",
defaults.ViMode,
comments("The current vi-mode (eg. KEYMAP for zsh) for vi-module module")),
}
powerline-go-1.25/config.go 0000664 0000000 0000000 00000007173 14634027167 0015666 0 ustar 00root root 0000000 0000000 package main
import (
"encoding/json"
"io/ioutil"
"os"
"path/filepath"
)
type SymbolMap map[string]SymbolTemplate
type ShellMap map[string]ShellInfo
type ThemeMap map[string]Theme
type AliasMap map[string]string
type Config struct {
CwdMode string `json:"cwd-mode"`
CwdMaxDepth int `json:"cwd-max-depth"`
CwdMaxDirSize int `json:"cwd-max-dir-size"`
ColorizeHostname bool `json:"colorize-hostname"`
HostnameOnlyIfSSH bool `json:"hostname-only-if-ssh"`
SshAlternateIcon bool `json:"alternate-ssh-icon"`
EastAsianWidth bool `json:"east-asian-width"`
PromptOnNewLine bool `json:"newline"`
StaticPromptIndicator bool `json:"static-prompt-indicator"`
VenvNameSizeLimit int `json:"venv-name-size-limit"`
Jobs int `json:"-"`
GitAssumeUnchangedSize int64 `json:"git-assume-unchanged-size"`
GitDisableStats []string `json:"git-disable-stats"`
GitMode string `json:"git-mode"`
Mode string `json:"mode"`
Theme string `json:"theme"`
Shell string `json:"shell"`
Modules []string `json:"modules"`
ModulesRight []string `json:"modules-right"`
Priority []string `json:"priority"`
MaxWidthPercentage int `json:"max-width-percentage"`
TruncateSegmentWidth int `json:"truncate-segment-width"`
PrevError int `json:"-"`
NumericExitCodes bool `json:"numeric-exit-codes"`
IgnoreRepos []string `json:"ignore-repos"`
ShortenGKENames bool `json:"shorten-gke-names"`
ShortenEKSNames bool `json:"shorten-eks-names"`
ShortenOpenshiftNames bool `json:"shorten-openshift-names"`
ShellVar string `json:"shell-var"`
ShellVarNoWarnEmpty bool `json:"shell-var-no-warn-empty"`
TrimADDomain bool `json:"trim-ad-domain"`
PathAliases AliasMap `json:"path-aliases"`
Duration string `json:"-"`
DurationMin string `json:"duration-min"`
DurationLowPrecision bool `json:"duration-low-precision"`
Eval bool `json:"eval"`
Condensed bool `json:"condensed"`
IgnoreWarnings bool `json:"ignore-warnings"`
Modes SymbolMap `json:"modes"`
Shells ShellMap `json:"shells"`
Themes ThemeMap `json:"themes"`
Time string `json:"-"`
ViMode string `json:"vi-mode"`
}
func (mode *SymbolTemplate) UnmarshalJSON(data []byte) error {
type Alias SymbolTemplate
tmp := defaults.Modes[defaults.Mode]
err := json.Unmarshal(data, (*Alias)(&tmp))
if err == nil {
*mode = tmp
}
return err
}
func (theme *Theme) UnmarshalJSON(data []byte) error {
type Alias Theme
tmp := defaults.Themes[defaults.Theme]
err := json.Unmarshal(data, (*Alias)(&tmp))
if err == nil {
*theme = tmp
}
return err
}
func configPath() string {
home, _ := os.UserHomeDir()
return filepath.Join(home, ".config", "powerline-go", "config.json")
}
func (cfg *Config) Load() error {
path := configPath()
file, err := ioutil.ReadFile(path)
if err != nil {
return nil // fail silently
}
return json.Unmarshal(file, cfg)
}
func (cfg *Config) Save() error {
path := configPath()
tmp := cfg
tmp.Themes = map[string]Theme{}
tmp.Modes = map[string]SymbolTemplate{}
tmp.Shells = map[string]ShellInfo{}
data, err := json.MarshalIndent(tmp, "", " ")
if err != nil {
return err
}
return ioutil.WriteFile(path, data, 0644)
}
powerline-go-1.25/defaults.go 0000664 0000000 0000000 00000074426 14634027167 0016235 0 ustar 00root root 0000000 0000000 //nolint:deadcode,varcheck
package main
var defaults = Config{
CwdMode: "fancy",
CwdMaxDepth: 5,
CwdMaxDirSize: -1,
ColorizeHostname: false,
HostnameOnlyIfSSH: false,
SshAlternateIcon: false,
EastAsianWidth: false,
PromptOnNewLine: false,
StaticPromptIndicator: false,
VenvNameSizeLimit: 0,
Jobs: 0,
GitAssumeUnchangedSize: 2048,
GitDisableStats: []string{},
GitMode: "fancy",
Mode: "patched",
Theme: "default",
Shell: "autodetect",
Modules: []string{
"venv",
"user",
"host",
"ssh",
"cwd",
"perms",
"git",
"hg",
"jobs",
"exit",
"root",
},
ModulesRight: []string{},
Priority: []string{
"root",
"cwd",
"user",
"host",
"ssh",
"perms",
"git-branch",
"git-status",
"hg",
"jobs",
"exit",
"cwd-path",
},
MaxWidthPercentage: 0,
TruncateSegmentWidth: 16,
PrevError: 0,
NumericExitCodes: false,
IgnoreRepos: []string{},
ShortenGKENames: false,
ShortenEKSNames: false,
ShellVar: "",
ShellVarNoWarnEmpty: false,
TrimADDomain: false,
PathAliases: AliasMap{},
Duration: "",
DurationMin: "0",
DurationLowPrecision: false,
Eval: false,
Condensed: false,
IgnoreWarnings: false,
Modes: SymbolMap{
"compatible": {
Lock: "RO",
Network: "SSH",
NetworkAlternate: "SSH",
Separator: "\u25B6",
SeparatorThin: "\u276F",
SeparatorReverse: "\u25C0",
SeparatorReverseThin: "\u276E",
RepoDetached: "\u2693",
RepoAhead: "\u2B06",
RepoBehind: "\u2B07",
RepoStaged: "\u2714",
RepoNotStaged: "\u270E",
RepoUntracked: "+",
RepoConflicted: "\u273C",
RepoStashed: "\u2691",
VenvIndicator: "\uE235",
NodeIndicator: "\u2B22",
RvmIndicator: "\uE92B",
},
"patched": {
Lock: "\uE0A2",
Network: "\u260E ",
NetworkAlternate: "\uE0A2",
Separator: "\uE0B0",
SeparatorThin: "\uE0B1",
SeparatorReverse: "\uE0B2",
SeparatorReverseThin: "\uE0B3",
RepoBranch: "\uE0A0",
RepoDetached: "\u2693",
RepoAhead: "\u2B06",
RepoBehind: "\u2B07",
RepoStaged: "\u2714",
RepoNotStaged: "\u270E",
RepoUntracked: "+",
RepoConflicted: "\u273C",
RepoStashed: "\u2691",
VenvIndicator: "\uE235",
NodeIndicator: "\u2B22",
RvmIndicator: "\uE92B",
},
"flat": {
RepoDetached: "\u2693",
RepoAhead: "\u2B06",
RepoBehind: "\u2B07",
RepoStaged: "\u2714",
RepoNotStaged: "\u270E",
RepoUntracked: "+",
RepoConflicted: "\u273C",
RepoStashed: "\u2691",
VenvIndicator: "\uE235",
NodeIndicator: "\u2B22",
RvmIndicator: "\uE92B",
},
},
Shells: ShellMap{
"bash": {
ColorTemplate: "\\[\\e%s\\]",
RootIndicator: "\\$",
EscapedBackslash: `\\\\`,
EscapedBacktick: "\\`",
EscapedDollar: `\$`,
EvalPromptPrefix: `PS1="`,
EvalPromptSuffix: `"`,
},
"zsh": {
ColorTemplate: "%%{\u001b%s%%}",
RootIndicator: "%#",
EscapedBackslash: `\\`,
EscapedBacktick: "\\`",
EscapedDollar: `\$`,
EvalPromptPrefix: `PROMPT="`,
EvalPromptSuffix: `"`,
EvalPromptRightPrefix: `RPROMPT="`,
EvalPromptRightSuffix: `"`,
},
"bare": {
ColorTemplate: "%s",
RootIndicator: "$",
EscapedBackslash: `\`,
EscapedBacktick: "`",
EscapedDollar: `$`,
},
},
Themes: ThemeMap{
"default": {
Reset: 0xFF,
DefaultFg: 250,
DefaultBg: 240,
UsernameFg: 250,
UsernameBg: 240,
UsernameRootBg: 124,
HostnameFg: 250,
HostnameBg: 238,
HomeSpecialDisplay: true,
HomeFg: 15, // white
HomeBg: 31, // blueish
AliasFg: 15, // white
AliasBg: 31, // blueish
PathFg: 250, // light grey
PathBg: 237, // dark grey
CwdFg: 254, // nearly-white grey
SeparatorFg: 244,
ReadonlyFg: 254,
ReadonlyBg: 124,
SSHFg: 254,
SSHBg: 166, // medium orange
DockerMachineFg: 177, // light purple
DockerMachineBg: 55, // purple
KubeClusterFg: 117,
KubeClusterBg: 26,
KubeNamespaceFg: 170,
KubeNamespaceBg: 17,
WSLMachineFg: 250, // light grey
WSLMachineBg: 238, // dark grey
DotEnvFg: 15, // white
DotEnvBg: 55, // purple
AWSFg: 15, // white
AWSBg: 172, // AWS orange
RepoCleanFg: 0, // black
RepoCleanBg: 148, // a light green color
RepoDirtyFg: 15, // white
RepoDirtyBg: 161, // pink/red
JobsFg: 39,
JobsBg: 238,
CmdPassedFg: 15,
CmdPassedBg: 236,
CmdFailedFg: 15,
CmdFailedBg: 161,
SvnChangesFg: 22, // dark green
SvnChangesBg: 148,
GCPFg: 117,
GCPBg: 26,
GitAheadFg: 250,
GitAheadBg: 240,
GitBehindFg: 250,
GitBehindBg: 240,
GitStagedFg: 15,
GitStagedBg: 22,
GitNotStagedFg: 15,
GitNotStagedBg: 130,
GitUntrackedFg: 15,
GitUntrackedBg: 52,
GitConflictedFg: 15,
GitConflictedBg: 9,
GitStashedFg: 15,
GitStashedBg: 20,
GoenvBg: 38, // approx. Gopher Blue
GoenvFg: 220, // approx. Secondary Yellow
VirtualEnvFg: 00,
VirtualEnvBg: 35, // a mid-tone green
VirtualGoFg: 220, // approx. Secondary Yellow
VirtualGoBg: 38, // approx. Gopher Blue
PerlbrewFg: 00,
PerlbrewBg: 20, // a mid-tone blue
PlEnvFg: 00,
PlEnvBg: 32,
TFWsFg: 15, // white
TFWsBg: 26, // blue
TimeFg: 15,
TimeBg: 236,
ShellVarFg: 52,
ShellVarBg: 11,
ShEnvFg: 15,
ShEnvBg: 130,
NodeFg: 15,
NodeBg: 40,
NodeVersionFg: 40,
NodeVersionBg: 15,
RvmFg: 255,
RvmBg: 160,
LoadFg: 15,
LoadBg: 22,
LoadHighBg: 161,
LoadAvgValue: 5,
LoadThresholdBad: 1.0,
NixShellFg: 15,
NixShellBg: 69, // a light blue
DurationFg: 250,
DurationBg: 237,
HostnameColorizedFgMap: map[uint8]uint8{
0: 250,
1: 250,
2: 120,
3: 228,
4: 250,
5: 250,
6: 123,
7: 238,
8: 0,
9: 0,
10: 0,
11: 0,
12: 250,
13: 0,
14: 0,
15: 242,
16: 250,
17: 250,
18: 250,
19: 189,
20: 254,
21: 250,
22: 83,
23: 87,
24: 117,
25: 188,
26: 254,
27: 0,
28: 120,
29: 122,
30: 123,
31: 159,
32: 255,
33: 0,
34: 157,
35: 158,
36: 159,
37: 159,
38: 195,
39: 0,
40: 194,
41: 194,
42: 195,
43: 195,
44: 195,
45: 0,
46: 0,
47: 0,
48: 0,
49: 0,
50: 0,
51: 0,
52: 250,
53: 250,
54: 250,
55: 189,
56: 254,
57: 250,
58: 227,
59: 253,
60: 255,
61: 0,
62: 233,
63: 17,
64: 192,
65: 255,
66: 195,
67: 232,
68: 233,
69: 17,
70: 193,
71: 232,
72: 232,
73: 232,
74: 234,
75: 236,
76: 194,
77: 235,
78: 235,
79: 235,
80: 235,
81: 237,
82: 0,
83: 237,
84: 237,
85: 237,
86: 237,
87: 237,
88: 250,
89: 250,
90: 250,
91: 189,
92: 254,
93: 0,
94: 222,
95: 255,
96: 255,
97: 232,
98: 233,
99: 17,
100: 228,
101: 15,
102: 232,
103: 233,
104: 17,
105: 18,
106: 229,
107: 232,
108: 234,
109: 234,
110: 236,
111: 54,
112: 230,
113: 235,
114: 22,
115: 237,
116: 238,
117: 238,
118: 0,
119: 237,
120: 22,
121: 23,
122: 23,
123: 23,
124: 252,
125: 252,
126: 189,
127: 189,
128: 254,
129: 0,
130: 223,
131: 232,
132: 232,
133: 232,
134: 233,
135: 17,
136: 229,
137: 232,
138: 233,
139: 234,
140: 53,
141: 18,
142: 229,
143: 232,
144: 234,
145: 236,
146: 17,
147: 19,
148: 230,
149: 235,
150: 238,
151: 22,
152: 23,
153: 24,
154: 0,
155: 237,
156: 22,
157: 2,
158: 29,
159: 6,
160: 254,
161: 254,
162: 254,
163: 254,
164: 254,
165: 0,
166: 255,
167: 233,
168: 233,
169: 234,
170: 234,
171: 235,
172: 230,
173: 234,
174: 52,
175: 235,
176: 53,
177: 53,
178: 230,
179: 235,
180: 236,
181: 52,
182: 53,
183: 55,
184: 230,
185: 235,
186: 238,
187: 58,
188: 240,
189: 20,
190: 0,
191: 238,
192: 58,
193: 64,
194: 35,
195: 66,
196: 0,
197: 0,
198: 0,
199: 0,
200: 0,
201: 0,
202: 0,
203: 235,
204: 235,
205: 235,
206: 235,
207: 53,
208: 0,
209: 236,
210: 52,
211: 237,
212: 53,
213: 53,
214: 0,
215: 236,
216: 238,
217: 1,
218: 89,
219: 5,
220: 0,
221: 237,
222: 58,
223: 95,
224: 131,
225: 126,
226: 0,
227: 238,
228: 58,
229: 3,
230: 143,
231: 242,
232: 250,
233: 250,
234: 250,
235: 250,
236: 250,
237: 250,
238: 251,
239: 252,
240: 188,
241: 254,
242: 254,
243: 255,
244: 0,
245: 232,
246: 233,
247: 234,
248: 235,
249: 236,
250: 237,
251: 238,
252: 239,
253: 240,
254: 242,
255: 243,
},
ViModeCommandFg: 0,
ViModeCommandBg: 250,
ViModeInsertFg: 22,
ViModeInsertBg: 70,
},
"low-contrast": {
Reset: 0xFF,
DefaultFg: 234,
DefaultBg: 250,
UsernameFg: 234,
UsernameBg: 250,
UsernameRootBg: 198,
HostnameFg: 234,
HostnameBg: 252,
HomeSpecialDisplay: true,
HomeFg: 30, // blueish-green
HomeBg: 15, // white
AliasFg: 30, // blueish-green
AliasBg: 15, // white
PathFg: 234,
PathBg: 254,
CwdFg: 236,
SeparatorFg: 244,
ReadonlyFg: 124,
ReadonlyBg: 253,
SSHFg: 166, // medium orange
SSHBg: 254,
DockerMachineFg: 55, // purple
DockerMachineBg: 177, // light purple
KubeClusterFg: 117,
KubeClusterBg: 26,
KubeNamespaceFg: 170,
KubeNamespaceBg: 17,
DotEnvFg: 15, // white
DotEnvBg: 55, // purple
RepoCleanFg: 232, // black
RepoCleanBg: 230, // light yellow
RepoDirtyFg: 232, // black
RepoDirtyBg: 223, // orange/peach
JobsFg: 238,
JobsBg: 39,
CmdPassedFg: 18,
CmdPassedBg: 7,
CmdFailedFg: 254,
CmdFailedBg: 124,
SvnChangesFg: 148,
SvnChangesBg: 22, // dark green
GitAheadFg: 240,
GitAheadBg: 250,
GitBehindFg: 240,
GitBehindBg: 251,
GitStagedFg: 22,
GitStagedBg: 15,
GitNotStagedFg: 130,
GitNotStagedBg: 15,
GitUntrackedFg: 52,
GitUntrackedBg: 15,
GitConflictedFg: 9,
GitConflictedBg: 15,
GitStashedFg: 15,
GitStashedBg: 20,
GoenvBg: 38, // approx. Gopher Blue
GoenvFg: 220, // approx. Secondary Yellow
VirtualEnvFg: 35, // a mid-tone green
VirtualEnvBg: 254,
VirtualGoFg: 220, // approx. Secondary Yellow
VirtualGoBg: 38, // approx. Gopher Blue
PerlbrewFg: 20, // a mid-tone blue
PerlbrewBg: 15,
PlEnvFg: 20, // a mid-tone blue
PlEnvBg: 15,
TimeFg: 236,
TimeBg: 15,
ShEnvFg: 130,
ShEnvBg: 15,
LoadFg: 15,
LoadBg: 22,
LoadHighBg: 161,
LoadAvgValue: 5,
LoadThresholdBad: 1.0,
RvmFg: 255,
RvmBg: 160,
NixShellFg: 69, // a light blue
NixShellBg: 254,
HostnameColorizedFgMap: map[uint8]uint8{
0: 250,
1: 250,
2: 120,
3: 228,
4: 250,
5: 250,
6: 123,
7: 238,
8: 0,
9: 0,
10: 0,
11: 0,
12: 250,
13: 0,
14: 0,
15: 242,
16: 250,
17: 250,
18: 250,
19: 189,
20: 254,
21: 250,
22: 83,
23: 87,
24: 117,
25: 188,
26: 254,
27: 0,
28: 120,
29: 122,
30: 123,
31: 159,
32: 255,
33: 0,
34: 157,
35: 158,
36: 159,
37: 159,
38: 195,
39: 0,
40: 194,
41: 194,
42: 195,
43: 195,
44: 195,
45: 0,
46: 0,
47: 0,
48: 0,
49: 0,
50: 0,
51: 0,
52: 250,
53: 250,
54: 250,
55: 189,
56: 254,
57: 250,
58: 227,
59: 253,
60: 255,
61: 0,
62: 233,
63: 17,
64: 192,
65: 255,
66: 195,
67: 232,
68: 233,
69: 17,
70: 193,
71: 232,
72: 232,
73: 232,
74: 234,
75: 236,
76: 194,
77: 235,
78: 235,
79: 235,
80: 235,
81: 237,
82: 0,
83: 237,
84: 237,
85: 237,
86: 237,
87: 237,
88: 250,
89: 250,
90: 250,
91: 189,
92: 254,
93: 0,
94: 222,
95: 255,
96: 255,
97: 232,
98: 233,
99: 17,
100: 228,
101: 15,
102: 232,
103: 233,
104: 17,
105: 18,
106: 229,
107: 232,
108: 234,
109: 234,
110: 236,
111: 54,
112: 230,
113: 235,
114: 22,
115: 237,
116: 238,
117: 238,
118: 0,
119: 237,
120: 22,
121: 23,
122: 23,
123: 23,
124: 252,
125: 252,
126: 189,
127: 189,
128: 254,
129: 0,
130: 223,
131: 232,
132: 232,
133: 232,
134: 233,
135: 17,
136: 229,
137: 232,
138: 233,
139: 234,
140: 53,
141: 18,
142: 229,
143: 232,
144: 234,
145: 236,
146: 17,
147: 19,
148: 230,
149: 235,
150: 238,
151: 22,
152: 23,
153: 24,
154: 0,
155: 237,
156: 22,
157: 2,
158: 29,
159: 6,
160: 254,
161: 254,
162: 254,
163: 254,
164: 254,
165: 0,
166: 255,
167: 233,
168: 233,
169: 234,
170: 234,
171: 235,
172: 230,
173: 234,
174: 52,
175: 235,
176: 53,
177: 53,
178: 230,
179: 235,
180: 236,
181: 52,
182: 53,
183: 55,
184: 230,
185: 235,
186: 238,
187: 58,
188: 240,
189: 20,
190: 0,
191: 238,
192: 58,
193: 64,
194: 35,
195: 66,
196: 0,
197: 0,
198: 0,
199: 0,
200: 0,
201: 0,
202: 0,
203: 235,
204: 235,
205: 235,
206: 235,
207: 53,
208: 0,
209: 236,
210: 52,
211: 237,
212: 53,
213: 53,
214: 0,
215: 236,
216: 238,
217: 1,
218: 89,
219: 5,
220: 0,
221: 237,
222: 58,
223: 95,
224: 131,
225: 126,
226: 0,
227: 238,
228: 58,
229: 3,
230: 143,
231: 242,
232: 250,
233: 250,
234: 250,
235: 250,
236: 250,
237: 250,
238: 251,
239: 252,
240: 188,
241: 254,
242: 254,
243: 255,
244: 0,
245: 232,
246: 233,
247: 234,
248: 235,
249: 236,
250: 237,
251: 238,
252: 239,
253: 240,
254: 242,
255: 243,
},
ViModeCommandFg: 0,
ViModeCommandBg: 250,
ViModeInsertFg: 22,
ViModeInsertBg: 70,
},
"solarized-dark16": {
Reset: 8,
DefaultFg: 15,
DefaultBg: 4,
UsernameFg: 15,
UsernameBg: 4,
UsernameRootBg: 1,
HostnameFg: 15,
HostnameBg: 0,
HomeSpecialDisplay: false,
HomeFg: 15,
HomeBg: 4,
PathFg: 15,
PathBg: 10,
CwdFg: 15,
SeparatorFg: 15,
ReadonlyFg: 8,
ReadonlyBg: 1,
SSHFg: 8,
SSHBg: 9,
DockerMachineFg: 13,
DockerMachineBg: 55,
DotEnvFg: 15,
DotEnvBg: 55,
RepoCleanFg: 15,
RepoCleanBg: 3,
RepoDirtyFg: 15,
RepoDirtyBg: 5,
JobsFg: 4,
JobsBg: 0,
CmdPassedFg: 15,
CmdPassedBg: 0,
CmdFailedFg: 15,
CmdFailedBg: 5,
SvnChangesFg: 2,
SvnChangesBg: 3,
GitAheadFg: 14,
GitAheadBg: 10,
GitBehindFg: 14,
GitBehindBg: 10,
GitStagedFg: 15,
GitStagedBg: 2,
GitNotStagedFg: 15,
GitNotStagedBg: 9,
GitUntrackedFg: 15,
GitUntrackedBg: 1,
GitConflictedFg: 15,
GitConflictedBg: 1,
GitStashedFg: 15,
GitStashedBg: 4,
GoenvBg: 38, // approx. Gopher Blue
GoenvFg: 220, // approx. Secondary Yellow
VirtualEnvFg: 8,
VirtualEnvBg: 6,
PerlbrewFg: 8,
PerlbrewBg: 4,
PlEnvFg: 8,
PlEnvBg: 4,
TimeFg: 15,
TimeBg: 0,
ShellVarFg: 1,
ShellVarBg: 11,
ShEnvFg: 15,
ShEnvBg: 9,
NodeFg: 15,
NodeBg: 40,
NodeVersionFg: 40,
NodeVersionBg: 15,
LoadFg: 15,
LoadBg: 2,
LoadHighBg: 5,
LoadAvgValue: 5,
LoadThresholdBad: 1.0,
RvmFg: 8,
RvmBg: 6,
NixShellFg: 0,
NixShellBg: 4,
HostnameColorizedFgMap: map[uint8]uint8{
0: 14,
1: 14,
2: 120,
3: 228,
4: 14,
5: 14,
6: 123,
7: 0,
8: 8,
9: 8,
10: 8,
11: 8,
12: 14,
13: 8,
14: 8,
15: 242,
16: 14,
17: 14,
18: 14,
19: 189,
20: 8,
21: 14,
22: 83,
23: 87,
24: 117,
25: 188,
26: 8,
27: 8,
28: 120,
29: 122,
30: 123,
31: 159,
32: 8,
33: 8,
34: 157,
35: 158,
36: 159,
37: 159,
38: 195,
39: 8,
40: 194,
41: 194,
42: 195,
43: 195,
44: 195,
45: 8,
46: 8,
47: 8,
48: 8,
49: 8,
50: 8,
51: 8,
52: 14,
53: 14,
54: 14,
55: 189,
56: 8,
57: 14,
58: 227,
59: 253,
60: 8,
61: 8,
62: 233,
63: 17,
64: 192,
65: 8,
66: 195,
67: 232,
68: 233,
69: 17,
70: 193,
71: 232,
72: 232,
73: 232,
74: 8,
75: 0,
76: 194,
77: 0,
78: 0,
79: 0,
80: 0,
81: 0,
82: 8,
83: 0,
84: 0,
85: 0,
86: 0,
87: 0,
88: 14,
89: 14,
90: 14,
91: 189,
92: 8,
93: 8,
94: 222,
95: 8,
96: 8,
97: 232,
98: 233,
99: 17,
100: 228,
101: 15,
102: 232,
103: 233,
104: 17,
105: 18,
106: 229,
107: 232,
108: 8,
109: 8,
110: 0,
111: 54,
112: 15,
113: 0,
114: 2,
115: 0,
116: 0,
117: 0,
118: 8,
119: 0,
120: 2,
121: 23,
122: 23,
123: 23,
124: 252,
125: 252,
126: 189,
127: 189,
128: 8,
129: 8,
130: 223,
131: 232,
132: 232,
133: 232,
134: 233,
135: 17,
136: 229,
137: 232,
138: 233,
139: 8,
140: 53,
141: 18,
142: 229,
143: 232,
144: 8,
145: 0,
146: 17,
147: 19,
148: 15,
149: 0,
150: 0,
151: 2,
152: 23,
153: 24,
154: 8,
155: 0,
156: 2,
157: 2,
158: 29,
159: 6,
160: 8,
161: 8,
162: 8,
163: 8,
164: 8,
165: 8,
166: 8,
167: 233,
168: 233,
169: 8,
170: 8,
171: 0,
172: 15,
173: 8,
174: 1,
175: 0,
176: 53,
177: 53,
178: 15,
179: 0,
180: 0,
181: 1,
182: 53,
183: 55,
184: 15,
185: 0,
186: 0,
187: 58,
188: 10,
189: 4,
190: 8,
191: 0,
192: 58,
193: 2,
194: 35,
195: 66,
196: 8,
197: 8,
198: 8,
199: 8,
200: 8,
201: 8,
202: 8,
203: 0,
204: 0,
205: 0,
206: 0,
207: 53,
208: 8,
209: 0,
210: 1,
211: 0,
212: 53,
213: 53,
214: 8,
215: 0,
216: 0,
217: 1,
218: 89,
219: 5,
220: 8,
221: 0,
222: 58,
223: 95,
224: 131,
225: 126,
226: 8,
227: 0,
228: 58,
229: 3,
230: 143,
231: 242,
232: 14,
233: 14,
234: 14,
235: 14,
236: 14,
237: 14,
238: 251,
239: 252,
240: 188,
241: 8,
242: 8,
243: 8,
244: 8,
245: 232,
246: 233,
247: 8,
248: 0,
249: 0,
250: 0,
251: 0,
252: 239,
253: 10,
254: 242,
255: 243,
},
ViModeCommandFg: 0,
ViModeCommandBg: 250,
ViModeInsertFg: 22,
ViModeInsertBg: 70,
},
"solarized-light16": {
Reset: 0,
DefaultFg: 15,
DefaultBg: 4,
UsernameFg: 15,
UsernameBg: 4,
UsernameRootBg: 1,
HostnameFg: 15,
HostnameBg: 7,
HomeSpecialDisplay: false,
HomeFg: 15,
HomeBg: 4,
PathFg: 15,
PathBg: 10,
CwdFg: 15,
SeparatorFg: 15,
ReadonlyFg: 8,
ReadonlyBg: 1,
SSHFg: 8,
SSHBg: 9,
DockerMachineFg: 13,
DockerMachineBg: 55,
DotEnvFg: 15,
DotEnvBg: 55,
RepoCleanFg: 15,
RepoCleanBg: 3,
RepoDirtyFg: 15,
RepoDirtyBg: 5,
JobsFg: 4,
JobsBg: 0,
CmdPassedFg: 10,
CmdPassedBg: 7,
CmdFailedFg: 15,
CmdFailedBg: 5,
SvnChangesFg: 2,
SvnChangesBg: 3,
GitAheadFg: 14,
GitAheadBg: 10,
GitBehindFg: 14,
GitBehindBg: 10,
GitStagedFg: 15,
GitStagedBg: 2,
GitNotStagedFg: 15,
GitNotStagedBg: 9,
GitUntrackedFg: 15,
GitUntrackedBg: 1,
GitConflictedFg: 15,
GitConflictedBg: 1,
GitStashedFg: 15,
GitStashedBg: 4,
GoenvBg: 38, // approx. Gopher Blue
GoenvFg: 220, // approx. Secondary Yellow
VirtualEnvFg: 8,
VirtualEnvBg: 6,
PerlbrewFg: 8,
PerlbrewBg: 4,
PlEnvFg: 8,
PlEnvBg: 4,
TimeFg: 15,
TimeBg: 0,
ShellVarFg: 1,
ShellVarBg: 11,
ShEnvFg: 15,
ShEnvBg: 9,
NodeFg: 15,
NodeBg: 40,
NodeVersionFg: 40,
NodeVersionBg: 15,
LoadFg: 15,
LoadBg: 2,
LoadHighBg: 5,
LoadAvgValue: 5,
LoadThresholdBad: 1.0,
RvmFg: 8,
RvmBg: 6,
NixShellFg: 0,
NixShellBg: 7,
HostnameColorizedFgMap: map[uint8]uint8{
0: 14,
1: 14,
2: 120,
3: 228,
4: 14,
5: 14,
6: 123,
7: 0,
8: 8,
9: 8,
10: 8,
11: 8,
12: 14,
13: 8,
14: 8,
15: 242,
16: 14,
17: 14,
18: 14,
19: 189,
20: 8,
21: 14,
22: 83,
23: 87,
24: 117,
25: 188,
26: 8,
27: 8,
28: 120,
29: 122,
30: 123,
31: 159,
32: 8,
33: 8,
34: 157,
35: 158,
36: 159,
37: 159,
38: 195,
39: 8,
40: 194,
41: 194,
42: 195,
43: 195,
44: 195,
45: 8,
46: 8,
47: 8,
48: 8,
49: 8,
50: 8,
51: 8,
52: 14,
53: 14,
54: 14,
55: 189,
56: 8,
57: 14,
58: 227,
59: 253,
60: 8,
61: 8,
62: 233,
63: 17,
64: 192,
65: 8,
66: 195,
67: 232,
68: 233,
69: 17,
70: 193,
71: 232,
72: 232,
73: 232,
74: 8,
75: 0,
76: 194,
77: 0,
78: 0,
79: 0,
80: 0,
81: 0,
82: 8,
83: 0,
84: 0,
85: 0,
86: 0,
87: 0,
88: 14,
89: 14,
90: 14,
91: 189,
92: 8,
93: 8,
94: 222,
95: 8,
96: 8,
97: 232,
98: 233,
99: 17,
100: 228,
101: 15,
102: 232,
103: 233,
104: 17,
105: 18,
106: 229,
107: 232,
108: 8,
109: 8,
110: 0,
111: 54,
112: 15,
113: 0,
114: 2,
115: 0,
116: 0,
117: 0,
118: 8,
119: 0,
120: 2,
121: 23,
122: 23,
123: 23,
124: 252,
125: 252,
126: 189,
127: 189,
128: 8,
129: 8,
130: 223,
131: 232,
132: 232,
133: 232,
134: 233,
135: 17,
136: 229,
137: 232,
138: 233,
139: 8,
140: 53,
141: 18,
142: 229,
143: 232,
144: 8,
145: 0,
146: 17,
147: 19,
148: 15,
149: 0,
150: 0,
151: 2,
152: 23,
153: 24,
154: 8,
155: 0,
156: 2,
157: 2,
158: 29,
159: 6,
160: 8,
161: 8,
162: 8,
163: 8,
164: 8,
165: 8,
166: 8,
167: 233,
168: 233,
169: 8,
170: 8,
171: 0,
172: 15,
173: 8,
174: 1,
175: 0,
176: 53,
177: 53,
178: 15,
179: 0,
180: 0,
181: 1,
182: 53,
183: 55,
184: 15,
185: 0,
186: 0,
187: 58,
188: 10,
189: 4,
190: 8,
191: 0,
192: 58,
193: 2,
194: 35,
195: 66,
196: 8,
197: 8,
198: 8,
199: 8,
200: 8,
201: 8,
202: 8,
203: 0,
204: 0,
205: 0,
206: 0,
207: 53,
208: 8,
209: 0,
210: 1,
211: 0,
212: 53,
213: 53,
214: 8,
215: 0,
216: 0,
217: 1,
218: 89,
219: 5,
220: 8,
221: 0,
222: 58,
223: 95,
224: 131,
225: 126,
226: 8,
227: 0,
228: 58,
229: 3,
230: 143,
231: 242,
232: 14,
233: 14,
234: 14,
235: 14,
236: 14,
237: 14,
238: 251,
239: 252,
240: 188,
241: 8,
242: 8,
243: 8,
244: 8,
245: 232,
246: 233,
247: 8,
248: 0,
249: 0,
250: 0,
251: 0,
252: 239,
253: 10,
254: 242,
255: 243,
},
ViModeCommandFg: 0,
ViModeCommandBg: 250,
ViModeInsertFg: 22,
ViModeInsertBg: 70,
},
"gruvbox": {
/* based on https://github.com/b-ryan/powerline-shell/blob/master/powerline_shell/themes/gruvbox.py */
Reset: 0,
DefaultFg: gruvbox_light0,
DefaultBg: gruvbox_dark0,
UsernameFg: gruvbox_bright_purple,
UsernameBg: gruvbox_dark2,
UsernameRootBg: gruvbox_faded_red,
HostnameFg: gruvbox_bright_purple,
HostnameBg: gruvbox_dark1,
HomeSpecialDisplay: true,
HomeFg: gruvbox_light2,
HomeBg: gruvbox_neutral_blue,
PathFg: gruvbox_light3,
PathBg: gruvbox_dark3,
CwdFg: gruvbox_light2,
SeparatorFg: gruvbox_dark_gray,
ReadonlyFg: gruvbox_light0,
ReadonlyBg: gruvbox_bright_red,
SSHFg: gruvbox_light0,
SSHBg: gruvbox_faded_purple,
DockerMachineFg: gruvbox_light0, // match ssh-fg
DockerMachineBg: gruvbox_faded_purple, // match ssh-bg
DotEnvFg: gruvbox_light0, // match ssh-fg
DotEnvBg: gruvbox_faded_purple, // match ssh-bg
RepoCleanFg: gruvbox_dark1,
RepoCleanBg: gruvbox_faded_green,
RepoDirtyFg: gruvbox_light0,
RepoDirtyBg: gruvbox_faded_orange,
JobsFg: gruvbox_neutral_aqua,
JobsBg: gruvbox_dark1,
CmdPassedFg: gruvbox_light4,
CmdPassedBg: gruvbox_dark1,
CmdFailedFg: gruvbox_light0,
CmdFailedBg: gruvbox_neutral_red,
SvnChangesFg: gruvbox_light0,
SvnChangesBg: gruvbox_faded_orange,
GitAheadFg: gruvbox_light3,
GitAheadBg: gruvbox_dark2,
GitBehindFg: gruvbox_light3,
GitBehindBg: gruvbox_dark2,
GitStagedFg: gruvbox_light0,
GitStagedBg: gruvbox_neutral_green,
GitNotStagedFg: gruvbox_light0,
GitNotStagedBg: gruvbox_neutral_orange,
GitUntrackedFg: gruvbox_light0,
GitUntrackedBg: gruvbox_faded_red,
GitConflictedFg: gruvbox_light0,
GitConflictedBg: gruvbox_neutral_red,
GitStashedFg: gruvbox_dark0,
GitStashedBg: gruvbox_neutral_yellow,
GoenvBg: gruvbox_faded_blue,
GoenvFg: gruvbox_light1,
VirtualEnvFg: gruvbox_light0,
VirtualEnvBg: gruvbox_faded_green,
PerlbrewFg: gruvbox_light0, // match virtualenv
PerlbrewBg: gruvbox_faded_green, // match virtualenv
PlEnvFg: gruvbox_light0, // match virtualenv
PlEnvBg: gruvbox_faded_green, // match virtualenv
TimeFg: gruvbox_light2,
TimeBg: gruvbox_dark4,
ShellVarFg: gruvbox_light0, // match ssh-fg
ShellVarBg: gruvbox_faded_purple, // match ssh-bg
NodeFg: gruvbox_light0, // match virtualenv
NodeBg: gruvbox_faded_green, // match virtualenv
NodeVersionFg: gruvbox_faded_green, // match virtualenv
NodeVersionBg: gruvbox_light0, // match virtualenv
RvmFg: gruvbox_light0,
RvmBg: gruvbox_neutral_red,
LoadFg: gruvbox_light0,
LoadBg: gruvbox_faded_purple,
LoadHighBg: gruvbox_neutral_red,
LoadAvgValue: gruvbox_light0,
LoadThresholdBad: 1.0,
NixShellFg: gruvbox_light0,
NixShellBg: gruvbox_faded_purple,
ViModeCommandFg: 0,
ViModeCommandBg: 250,
ViModeInsertFg: 22,
ViModeInsertBg: 70,
},
},
Time: "15:04:05",
ViMode: "",
}
const (
gruvbox_dark0 = 235
gruvbox_dark1 = 237
gruvbox_dark2 = 239
gruvbox_dark3 = 241
gruvbox_dark4 = 243
gruvbox_light0 = 229
gruvbox_light1 = 223
gruvbox_light2 = 250
gruvbox_light3 = 248
gruvbox_light4 = 246
gruvbox_dark_gray = 245
gruvbox_light_gray = 244
gruvbox_neutral_red = 124
gruvbox_neutral_green = 106
gruvbox_neutral_yellow = 172
gruvbox_neutral_blue = 66
gruvbox_neutral_purple = 132
gruvbox_neutral_aqua = 72
gruvbox_neutral_orange = 166
gruvbox_bright_red = 167
gruvbox_bright_green = 142
gruvbox_bright_yellow = 214
gruvbox_bright_blue = 109
gruvbox_bright_purple = 175
gruvbox_bright_aqua = 108
gruvbox_bright_orange = 208
gruvbox_faded_red = 88
gruvbox_faded_green = 100
gruvbox_faded_yellow = 136
gruvbox_faded_blue = 24
gruvbox_faded_purple = 96
gruvbox_faded_aqua = 66
gruvbox_faded_orange = 130
)
powerline-go-1.25/environment.go 0000664 0000000 0000000 00000000222 14634027167 0016751 0 ustar 00root root 0000000 0000000 package main
import "runtime"
func homeEnvName() string {
env := "HOME"
if runtime.GOOS == "windows" {
env = "USERPROFILE"
}
return env
}
powerline-go-1.25/exitcode/ 0000775 0000000 0000000 00000000000 14634027167 0015666 5 ustar 00root root 0000000 0000000 powerline-go-1.25/exitcode/exitcode_darwin.go 0000664 0000000 0000000 00000001131 14634027167 0021361 0 ustar 00root root 0000000 0000000 package exitcode
var Signals = map[int]string{
0x01: "SIGHUP",
0x02: "SIGINT",
0x03: "SIGQUIT",
0x04: "SIGILL",
0x05: "SIGTRAP",
0x06: "SIGABRT",
0x07: "SIGEMT",
0x08: "SIGFPE",
0x09: "SIGKILL",
0x0a: "SIGBUS",
0x0b: "SIGSEGV",
0x0c: "SIGSYS",
0x0d: "SIGPIPE",
0x0e: "SIGALRM",
0x0f: "SIGTERM",
0x10: "SIGURG",
0x11: "SIGSTOP",
0x12: "SIGTSTP",
0x13: "SIGCONT",
0x14: "SIGCHLD",
0x15: "SIGTTIN",
0x16: "SIGTTOU",
0x17: "SIGIO",
0x18: "SIGXCPU",
0x19: "SIGXFSZ",
0x1a: "SIGVTALRM",
0x1b: "SIGPROF",
0x1c: "SIGWINCH",
0x1d: "SIGINFO",
0x1e: "SIGUSR1",
0x1f: "SIGUSR2",
}
powerline-go-1.25/exitcode/exitcode_dragonfly.go 0000664 0000000 0000000 00000001156 14634027167 0022071 0 ustar 00root root 0000000 0000000 package exitcode
var Signals = map[int]string{
0x01: "SIGHUP",
0x02: "SIGINT",
0x03: "SIGQUIT",
0x04: "SIGILL",
0x05: "SIGTRAP",
0x06: "SIGABRT",
0x07: "SIGEMT",
0x08: "SIGFPE",
0x09: "SIGKILL",
0x0A: "SIGBUS",
0x0B: "SIGSEGV",
0x0C: "SIGSYS",
0x0D: "SIGPIPE",
0x0E: "SIGALRM",
0x0F: "SIGTERM",
0x10: "SIGURG",
0x11: "SIGSTOP",
0x12: "SIGTSTP",
0x13: "SIGCONT",
0x14: "SIGCHLD",
0x15: "SIGTTIN",
0x16: "SIGTTOU",
0x17: "SIGIO",
0x18: "SIGXCPU",
0x19: "SIGXFSZ",
0x1A: "SIGVTALRM",
0x1B: "SIGPROF",
0x1C: "SIGWINCH",
0x1D: "SIGINFO",
0x20: "SIGTHR",
0x21: "SIGCKPT",
0x22: "SIGCKPTEXIT",
}
powerline-go-1.25/exitcode/exitcode_freebsd.go 0000664 0000000 0000000 00000001175 14634027167 0021517 0 ustar 00root root 0000000 0000000 package exitcode
var Signals = map[int]string{
0x01: "SIGHUP",
0x02: "SIGINT",
0x03: "SIGQUIT",
0x04: "SIGILL",
0x05: "SIGTRAP",
0x06: "SIGABRT",
0x07: "SIGEMT",
0x08: "SIGFPE",
0x09: "SIGKILL",
0x0a: "SIGBUS",
0x0b: "SIGSEGV",
0x0c: "SIGSYS",
0x0d: "SIGPIPE",
0x0e: "SIGALRM",
0x0f: "SIGTERM",
0x10: "SIGURG",
0x11: "SIGSTOP",
0x12: "SIGTSTP",
0x13: "SIGCONT",
0x14: "SIGCHLD",
0x15: "SIGTTIN",
0x16: "SIGTTOU",
0x17: "SIGIO",
0x18: "SIGXCPU",
0x19: "SIGXFSZ",
0x1a: "SIGVTALRM",
0x1b: "SIGPROF",
0x1c: "SIGWINCH",
0x1d: "SIGINFO",
0x1e: "SIGUSR1",
0x1f: "SIGUSR2",
0x20: "SIGTHR",
0x21: "SIGLIBRT",
}
powerline-go-1.25/exitcode/exitcode_linux.go 0000664 0000000 0000000 00000001133 14634027167 0021236 0 ustar 00root root 0000000 0000000 package exitcode
var Signals = map[int]string{
0x01: "SIGHUP",
0x02: "SIGINT",
0x03: "SIGQUIT",
0x04: "SIGILL",
0x05: "SIGTRAP",
0x06: "SIGABRT",
0x07: "SIGBUS",
0x08: "SIGFPE",
0x09: "SIGKILL",
0x0a: "SIGUSR1",
0x0b: "SIGSEGV",
0x0c: "SIGUSR2",
0x0d: "SIGPIPE",
0x0e: "SIGALRM",
0x0f: "SIGTERM",
0x10: "SIGSTKFLT",
0x11: "SIGCHLD",
0x12: "SIGCONT",
0x13: "SIGSTOP",
0x14: "SIGTSTP",
0x15: "SIGTTIN",
0x16: "SIGTTOU",
0x17: "SIGURG",
0x18: "SIGXCPU",
0x19: "SIGXFSZ",
0x1a: "SIGVTALRM",
0x1b: "SIGPROF",
0x1c: "SIGWINCH",
0x1d: "SIGIO",
0x1e: "SIGPWR",
0x1f: "SIGSYS",
}
powerline-go-1.25/exitcode/exitcode_netbsd.go 0000664 0000000 0000000 00000001152 14634027167 0021357 0 ustar 00root root 0000000 0000000 package exitcode
var Signals = map[int]string{
0x01: "SIGHUP",
0x02: "SIGINT",
0x03: "SIGQUIT",
0x04: "SIGILL",
0x05: "SIGTRAP",
0x06: "SIGABRT",
0x07: "SIGEMT",
0x08: "SIGFPE",
0x09: "SIGKILL",
0x0a: "SIGBUS",
0x0b: "SIGSEGV",
0x0c: "SIGSYS",
0x0d: "SIGPIPE",
0x0e: "SIGALRM",
0x0f: "SIGTERM",
0x10: "SIGURG",
0x11: "SIGSTOP",
0x12: "SIGTSTP",
0x13: "SIGCONT",
0x14: "SIGCHLD",
0x15: "SIGTTIN",
0x16: "SIGTTOU",
0x17: "SIGIO",
0x18: "SIGXCPU",
0x19: "SIGXFSZ",
0x1a: "SIGVTALRM",
0x1b: "SIGPROF",
0x1c: "SIGWINCH",
0x1d: "SIGINFO",
0x1e: "SIGUSR1",
0x1f: "SIGUSR2",
0x20: "SIGPWR",
}
powerline-go-1.25/exitcode/exitcode_openbsd.go 0000664 0000000 0000000 00000001153 14634027167 0021533 0 ustar 00root root 0000000 0000000 package exitcode
var Signals = map[int]string{
0x01: "SIGHUP",
0x02: "SIGINT",
0x03: "SIGQUIT",
0x04: "SIGILL",
0x05: "SIGTRAP",
0x06: "SIGABRT",
0x07: "SIGEMT",
0x08: "SIGFPE",
0x09: "SIGKILL",
0x0a: "SIGBUS",
0x0b: "SIGSEGV",
0x0c: "SIGSYS",
0x0d: "SIGPIPE",
0x0e: "SIGALRM",
0x0f: "SIGTERM",
0x10: "SIGURG",
0x11: "SIGSTOP",
0x12: "SIGTSTP",
0x13: "SIGCONT",
0x14: "SIGCHLD",
0x15: "SIGTTIN",
0x16: "SIGTTOU",
0x17: "SIGIO",
0x18: "SIGXCPU",
0x19: "SIGXFSZ",
0x1a: "SIGVTALRM",
0x1b: "SIGPROF",
0x1c: "SIGWINCH",
0x1d: "SIGINFO",
0x1e: "SIGUSR1",
0x1f: "SIGUSR2",
0x20: "SIGTHR",
}
powerline-go-1.25/exitcode/exitcode_solaris.go 0000664 0000000 0000000 00000001400 14634027167 0021550 0 ustar 00root root 0000000 0000000 package exitcode
var Signals = map[int]string{
0x01: "SIGHUP",
0x02: "SIGINT",
0x03: "SIGQUIT",
0x04: "SIGILL",
0x05: "SIGTRAP",
0x06: "SIGABRT",
0x07: "SIGEMT",
0x08: "SIGFPE",
0x09: "SIGKILL",
0x0a: "SIGBUS",
0x0b: "SIGSEGV",
0x0c: "SIGSYS",
0x0d: "SIGPIPE",
0x0e: "SIGALRM",
0x0f: "SIGTERM",
0x10: "SIGUSR1",
0x11: "SIGUSR2",
0x12: "SIGCHLD",
0x13: "SIGPWR",
0x14: "SIGWINCH",
0x15: "SIGURG",
0x16: "SIGIO",
0x17: "SIGSTOP",
0x18: "SIGTSTP",
0x19: "SIGCONT",
0x1a: "SIGTTIN",
0x1b: "SIGTTOU",
0x1c: "SIGVTALRM",
0x1d: "SIGPROF",
0x1e: "SIGXCPU",
0x1f: "SIGXFSZ",
0x20: "SIGWAITING",
0x21: "SIGLWP",
0x22: "SIGFREEZE",
0x23: "SIGTHAW",
0x24: "SIGCANCEL",
0x25: "SIGLOST",
0x26: "SIGXRES",
0x27: "SIGJVM1",
0x28: "SIGJVM2",
}
powerline-go-1.25/exitcode/exitcode_windows.go 0000664 0000000 0000000 00000000140 14634027167 0021566 0 ustar 00root root 0000000 0000000 package exitcode
var Signals = map[int]string{
// We don’t support named errors on Windows
}
powerline-go-1.25/exitcode/exitcode_zos.go 0000664 0000000 0000000 00000001220 14634027167 0020707 0 ustar 00root root 0000000 0000000 package exitcode
var Signals = map[int]string{
0x01: "SIGHUP",
0x02: "SIGINT",
0x03: "SIGABRT",
0x04: "SIGILL",
0x05: "SIGPOLL",
0x06: "SIGURG",
0x07: "SIGSTOP",
0x08: "SIGFPE",
0x09: "SIGKILL",
0x0a: "SIGBUS",
0x0b: "SIGSEGV",
0x0c: "SIGSYS",
0x0d: "SIGPIPE",
0x0e: "SIGALRM",
0x0f: "SIGTERM",
0x10: "SIGUSR1",
0x11: "SIGUSR2",
0x12: "SIGABND",
0x13: "SIGCONT",
0x14: "SIGCHLD",
0x15: "SIGTTIN",
0x16: "SIGTTOU",
0x17: "SIGIO",
0x18: "SIGQUIT",
0x19: "SIGTSTP",
0x1a: "SIGTRAP",
0x1b: "SIGIOERR",
0x1c: "SIGWINCH",
0x1d: "SIGXCPU",
0x1e: "SIGXFSZ",
0x1f: "SIGVTALRM",
0x20: "SIGPROF",
0x26: "SIGDCE",
0x27: "SIGDUMP",
}
powerline-go-1.25/generatePreview.sh 0000775 0000000 0000000 00000001761 14634027167 0017562 0 ustar 00root root 0000000 0000000 #!/bin/sh
FLAGS="-modules cwd,git,root -path-aliases=/tmp/home=~"
mkdir -p /tmp/home/code/dotfiles;
cd /tmp/home/code/dotfiles/;
git init;
touch file1;
git add .;
git commit -m "commit";
echo "hI" > file2;
mkdir -p /tmp/home/deep/down/into/the/abyss/of/directories/where/no/one/ever/comes/;
cd /tmp/home/deep/down/into/the/abyss/of/directories/where/no/one/ever/comes/;
git init;
touch file1;
git add .;
git commit -m "commit";
echo "test">file1;
git stash;
export HOME=/tmp/home/
clear;
cd /tmp/home/code/dotfiles/;
powerline-go -shell bare $FLAGS;
echo git branch;
git branch --color=always | cat;
powerline-go -shell bare $FLAGS;
echo badcmd;
echo "bash: badcmd: command not found";
powerline-go -shell bare $FLAGS -error 1;
echo "cd ~/deep/down/into/the/abyss/of/directories/where/no/one/ever/comes/";
cd /tmp/home/deep/down/into/the/abyss/of/directories/where/no/one/ever/comes/;
powerline-go -shell bare $FLAGS;
echo;echo;echo;echo;echo;echo;echo;echo;echo;echo;echo;echo;echo;echo;echo;echo;
powerline-go-1.25/go.mod 0000664 0000000 0000000 00000000503 14634027167 0015166 0 ustar 00root root 0000000 0000000 module github.com/justjanne/powerline-go
go 1.15
require (
github.com/mattn/go-runewidth v0.0.9
github.com/shirou/gopsutil/v3 v3.22.3
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211
golang.org/x/text v0.3.8
gopkg.in/ini.v1 v1.66.4
gopkg.in/yaml.v2 v2.4.0
)
powerline-go-1.25/go.sum 0000664 0000000 0000000 00000014314 14634027167 0015220 0 ustar 00root root 0000000 0000000 github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o=
github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE=
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4=
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I=
github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw=
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
github.com/shirou/gopsutil/v3 v3.22.3 h1:UebRzEomgMpv61e3hgD1tGooqX5trFbdU/ehphbHd00=
github.com/shirou/gopsutil/v3 v3.22.3/go.mod h1:D01hZJ4pVHPpCTZ3m3T2+wDF2YAGfd+H4ifUguaQzHM=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/tklauser/go-sysconf v0.3.10 h1:IJ1AZGZRWbY8T5Vfk04D9WOA5WSejdflXxP03OUqALw=
github.com/tklauser/go-sysconf v0.3.10/go.mod h1:C8XykCvCb+Gn0oNCWPIlcb0RuglQTYaQ2hGm7jmxEFk=
github.com/tklauser/numcpus v0.4.0 h1:E53Dm1HjH1/R2/aoCtXtPgzmElmn51aOkhCFSuZq//o=
github.com/tklauser/numcpus v0.4.0/go.mod h1:1+UI3pD8NW14VMwdgJNJ1ESk2UnwhAnz5hMwiKKqXCQ=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg=
github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.3.8 h1:nAL+RVCQ9uMn3vJZbV+MRnydTJFPf8qqY42YiA6MrqY=
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/ini.v1 v1.66.4 h1:SsAcf+mM7mRZo2nJNGt8mZCjG8ZRaNGMURJw7BsIST4=
gopkg.in/ini.v1 v1.66.4/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
powerline-go-1.25/main.go 0000664 0000000 0000000 00000015400 14634027167 0015335 0 ustar 00root root 0000000 0000000 package main
import (
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"os"
"strings"
pwl "github.com/justjanne/powerline-go/powerline"
)
type alignment int
const (
alignLeft alignment = iota
alignRight
)
const (
// MinUnsignedInteger minimum unsigned integer
MinUnsignedInteger uint = 0
// MaxUnsignedInteger maximum unsigned integer
MaxUnsignedInteger = ^MinUnsignedInteger
// MaxInteger maximum integer
MaxInteger = int(MaxUnsignedInteger >> 1)
/* MinInteger minimum integer
MinInteger = ^MaxInteger
*/
)
func warn(msg string) {
if *args.IgnoreWarnings {
return
}
print("[powerline-go]", msg)
}
func pathExists(path string) bool {
if _, err := os.Stat(path); os.IsNotExist(err) {
return false
}
return true
}
func getValidCwd() string {
cwd, err := os.Getwd()
if err != nil {
var exists bool
cwd, exists = os.LookupEnv("PWD")
if !exists {
warn("Your current directory is invalid.")
print("> ")
os.Exit(1)
}
}
parts := strings.Split(cwd, string(os.PathSeparator))
up := cwd
for len(parts) > 0 && !pathExists(up) {
parts = parts[:len(parts)-1]
up = strings.Join(parts, string(os.PathSeparator))
}
if cwd != up {
warn("Your current directory is invalid. Lowest valid directory: " + up)
}
return cwd
}
var modules = map[string]func(*powerline) []pwl.Segment{
"aws": segmentAWS,
"bzr": segmentBzr,
"cwd": segmentCwd,
"direnv": segmentDirenv,
"docker": segmentDocker,
"docker-context": segmentDockerContext,
"dotenv": segmentDotEnv,
"duration": segmentDuration,
"exit": segmentExitCode,
"fossil": segmentFossil,
"gcp": segmentGCP,
"git": segmentGit,
"gitlite": segmentGitLite,
"goenv": segmentGoenv,
"hg": segmentHg,
"svn": segmentSubversion,
"host": segmentHost,
"jobs": segmentJobs,
"kube": segmentKube,
"load": segmentLoad,
"newline": segmentNewline,
"perlbrew": segmentPerlbrew,
"plenv": segmentPlEnv,
"perms": segmentPerms,
"rbenv": segmentRbenv,
"root": segmentRoot,
"rvm": segmentRvm,
"shell-var": segmentShellVar,
"shenv": segmentShEnv,
"ssh": segmentSSH,
"termtitle": segmentTermTitle,
"terraform-workspace": segmentTerraformWorkspace,
"time": segmentTime,
"node": segmentNode,
"user": segmentUser,
"venv": segmentVirtualEnv,
"vgo": segmentVirtualGo,
"vi-mode": segmentViMode,
"wsl": segmentWSL,
"nix-shell": segmentNixShell,
}
func comments(lines ...string) string {
return " " + strings.Join(lines, "\n"+" ")
}
func commentsWithDefaults(lines ...string) string {
return comments(lines...) + "\n"
}
func main() {
flag.Parse()
cfg := defaults
err := cfg.Load()
if err != nil {
println("Error loading config")
println(err.Error())
}
flag.Visit(func(f *flag.Flag) {
switch f.Name {
case "cwd-mode":
cfg.CwdMode = *args.CwdMode
case "cwd-max-depth":
cfg.CwdMaxDepth = *args.CwdMaxDepth
case "cwd-max-dir-size":
cfg.CwdMaxDirSize = *args.CwdMaxDirSize
case "colorize-hostname":
cfg.ColorizeHostname = *args.ColorizeHostname
case "hostname-only-if-ssh":
cfg.HostnameOnlyIfSSH = *args.HostnameOnlyIfSSH
case "alternate-ssh-icon":
cfg.SshAlternateIcon = *args.SshAlternateIcon
case "east-asian-width":
cfg.EastAsianWidth = *args.EastAsianWidth
case "newline":
cfg.PromptOnNewLine = *args.PromptOnNewLine
case "static-prompt-indicator":
cfg.StaticPromptIndicator = *args.StaticPromptIndicator
case "venv-name-size-limit":
cfg.VenvNameSizeLimit = *args.VenvNameSizeLimit
case "jobs":
cfg.Jobs = *args.Jobs
case "git-assume-unchanged-size":
cfg.GitAssumeUnchangedSize = *args.GitAssumeUnchangedSize
case "git-disable-stats":
cfg.GitDisableStats = strings.Split(*args.GitDisableStats, ",")
case "git-mode":
cfg.GitMode = *args.GitMode
case "mode":
cfg.Mode = *args.Mode
case "theme":
cfg.Theme = *args.Theme
case "shell":
cfg.Shell = *args.Shell
case "modules":
cfg.Modules = strings.Split(*args.Modules, ",")
case "modules-right":
cfg.ModulesRight = strings.Split(*args.ModulesRight, ",")
case "priority":
cfg.Priority = strings.Split(*args.Priority, ",")
case "max-width":
cfg.MaxWidthPercentage = *args.MaxWidthPercentage
case "truncate-segment-width":
cfg.TruncateSegmentWidth = *args.TruncateSegmentWidth
case "error":
cfg.PrevError = *args.PrevError
case "numeric-exit-codes":
cfg.NumericExitCodes = *args.NumericExitCodes
case "ignore-repos":
cfg.IgnoreRepos = strings.Split(*args.IgnoreRepos, ",")
case "shorten-gke-names":
cfg.ShortenGKENames = *args.ShortenGKENames
case "shorten-eks-names":
cfg.ShortenEKSNames = *args.ShortenEKSNames
case "shorten-openshift-names":
cfg.ShortenOpenshiftNames = *args.ShortenOpenshiftNames
case "shell-var":
cfg.ShellVar = *args.ShellVar
case "shell-var-no-warn-empty":
cfg.ShellVarNoWarnEmpty = *args.ShellVarNoWarnEmpty
case "trim-ad-domain":
cfg.TrimADDomain = *args.TrimADDomain
case "path-aliases":
for _, pair := range strings.Split(*args.PathAliases, ",") {
kv := strings.SplitN(pair, "=", 2)
cfg.PathAliases[kv[0]] = kv[1]
}
case "duration":
cfg.Duration = *args.Duration
case "duration-min":
cfg.DurationMin = *args.DurationMin
case "duration-low-precision":
cfg.DurationLowPrecision = *args.DurationLowPrecision
case "eval":
cfg.Eval = *args.Eval
case "condensed":
cfg.Condensed = *args.Condensed
case "ignore-warnings":
cfg.IgnoreWarnings = *args.IgnoreWarnings
case "time":
cfg.Time = *args.Time
case "vi-mode":
cfg.ViMode = *args.ViMode
}
})
if strings.HasSuffix(cfg.Theme, ".json") {
file, err := ioutil.ReadFile(cfg.Theme)
if err == nil {
theme := cfg.Themes[defaults.Theme]
err = json.Unmarshal(file, &theme)
if err == nil {
cfg.Themes[cfg.Theme] = theme
} else {
println("Error reading theme")
println(err.Error())
}
}
}
if strings.HasSuffix(cfg.Mode, ".json") {
file, err := ioutil.ReadFile(cfg.Mode)
if err == nil {
symbols := cfg.Modes[defaults.Mode]
err = json.Unmarshal(file, &symbols)
if err == nil {
cfg.Modes[cfg.Mode] = symbols
} else {
println("Error reading mode")
println(err.Error())
}
}
}
p := newPowerline(cfg, getValidCwd(), alignLeft)
if p.supportsRightModules() && p.hasRightModules() && !cfg.Eval {
panic("Flag '-modules-right' requires '-eval' mode.")
}
fmt.Print(p.draw())
}
powerline-go-1.25/powerline.go 0000664 0000000 0000000 00000027145 14634027167 0016426 0 ustar 00root root 0000000 0000000 package main
import (
"bytes"
"fmt"
"os"
"os/user"
"path"
"strconv"
"strings"
"sync"
pwl "github.com/justjanne/powerline-go/powerline"
"github.com/mattn/go-runewidth"
"github.com/shirou/gopsutil/v3/process"
"golang.org/x/term"
"golang.org/x/text/width"
)
// ShellInfo holds the shell information
type ShellInfo struct {
RootIndicator string
ColorTemplate string
EscapedDollar string
EscapedBacktick string
EscapedBackslash string
EvalPromptPrefix string
EvalPromptSuffix string
EvalPromptRightPrefix string
EvalPromptRightSuffix string
}
type powerline struct {
cfg Config
cwd string
userInfo user.User
userIsAdmin bool
hostname string
username string
theme Theme
shell ShellInfo
reset string
symbols SymbolTemplate
priorities map[string]int
ignoreRepos map[string]bool
Segments [][]pwl.Segment
curSegment int
align alignment
rightPowerline *powerline
}
type prioritizedSegments struct {
i int
segs []pwl.Segment
}
func newPowerline(cfg Config, cwd string, align alignment) *powerline {
p := new(powerline)
p.cfg = cfg
p.cwd = cwd
userInfo, err := user.Current()
if userInfo != nil && err == nil {
p.userInfo = *userInfo
}
p.hostname, _ = os.Hostname()
hostnamePrefix := fmt.Sprintf("%s%c", p.hostname, os.PathSeparator)
if strings.HasPrefix(p.userInfo.Username, hostnamePrefix) {
p.username = p.userInfo.Username[len(hostnamePrefix):]
} else {
p.username = p.userInfo.Username
}
if cfg.TrimADDomain {
usernameWithAd := strings.SplitN(p.username, `\`, 2)
if len(usernameWithAd) > 1 {
// remove the Domain name from username
p.username = usernameWithAd[1]
}
}
p.userIsAdmin = userIsAdmin()
p.theme = cfg.Themes[cfg.Theme]
if cfg.Shell == "autodetect" {
var shellExe string
proc, err := process.NewProcess(int32(os.Getppid()))
if err == nil {
shellExe, _ = proc.Exe()
}
if shellExe == "" {
shellExe = os.Getenv("SHELL")
}
cfg.Shell = detectShell(shellExe)
}
p.shell = cfg.Shells[cfg.Shell]
p.reset = fmt.Sprintf(p.shell.ColorTemplate, "[0m")
p.symbols = cfg.Modes[cfg.Mode]
p.priorities = make(map[string]int)
for idx, priority := range cfg.Priority {
p.priorities[priority] = len(cfg.Priority) - idx
}
p.align = align
p.ignoreRepos = make(map[string]bool)
for _, r := range cfg.IgnoreRepos {
if r == "" {
continue
}
p.ignoreRepos[r] = true
}
p.Segments = make([][]pwl.Segment, 1)
var mods []string
if p.align == alignLeft {
mods = cfg.Modules
if len(cfg.ModulesRight) > 0 {
if p.supportsRightModules() {
p.rightPowerline = newPowerline(cfg, cwd, alignRight)
} else {
mods = append(mods, cfg.ModulesRight...)
}
}
} else {
mods = cfg.ModulesRight
}
initSegments(p, mods)
return p
}
func detectShell(shellExe string) string {
var shell string
shellExe = path.Base(shellExe)
if strings.Contains(shellExe, "bash") {
shell = "bash"
} else if strings.Contains(shellExe, "zsh") {
shell = "zsh"
} else {
shell = "bare"
}
return shell
}
func initSegments(p *powerline, mods []string) {
orderedSegments := map[int][]pwl.Segment{}
c := make(chan prioritizedSegments, len(mods))
wg := sync.WaitGroup{}
for i, module := range mods {
wg.Add(1)
go func(w *sync.WaitGroup, i int, module string, c chan prioritizedSegments) {
elem, ok := modules[module]
if ok {
c <- prioritizedSegments{
i: i,
segs: elem(p),
}
} else {
s, ok := segmentPlugin(p, module)
if ok {
c <- prioritizedSegments{
i: i,
segs: s,
}
} else {
println("Module not found: " + module)
}
}
wg.Done()
}(&wg, i, module, c)
}
wg.Wait()
close(c)
for s := range c {
orderedSegments[s.i] = s.segs
}
for i := 0; i < len(mods); i++ {
for _, seg := range orderedSegments[i] {
p.appendSegment(seg.Name, seg)
}
}
}
func (p *powerline) color(prefix string, code uint8) string {
if code == p.theme.Reset {
return p.reset
}
return fmt.Sprintf(p.shell.ColorTemplate, fmt.Sprintf("[%s;5;%dm", prefix, code))
}
func (p *powerline) fgColor(code uint8) string {
if p.theme.BoldForeground {
return p.color("1;38", code)
} else {
return p.color("38", code)
}
}
func (p *powerline) bgColor(code uint8) string {
return p.color("48", code)
}
func (p *powerline) appendSegment(origin string, segment pwl.Segment) {
if segment.Foreground == segment.Background && segment.Background == 0 {
segment.Background = p.theme.DefaultBg
segment.Foreground = p.theme.DefaultFg
}
if segment.Separator == "" {
if p.isRightPrompt() {
segment.Separator = p.symbols.SeparatorReverse
} else {
segment.Separator = p.symbols.Separator
}
}
if segment.SeparatorForeground == 0 {
segment.SeparatorForeground = segment.Background
}
segment.Priority += p.priorities[origin]
segment.Width = segment.ComputeWidth(p.cfg.Condensed)
if segment.NewLine {
p.newRow()
} else {
p.Segments[p.curSegment] = append(p.Segments[p.curSegment], segment)
}
}
func (p *powerline) newRow() {
if len(p.Segments[p.curSegment]) > 0 {
p.Segments = append(p.Segments, make([]pwl.Segment, 0))
p.curSegment = p.curSegment + 1
}
}
func termWidth() int {
termWidth, _, err := term.GetSize(int(os.Stdin.Fd()))
if err != nil {
shellMaxLengthStr, found := os.LookupEnv("COLUMNS")
if !found {
return 0
}
shellMaxLength64, err := strconv.ParseInt(shellMaxLengthStr, 0, 64)
if err != nil {
return 0
}
termWidth = int(shellMaxLength64)
}
return termWidth
}
func (p *powerline) truncateRow(rowNum int) {
shellMaxLength := termWidth() * p.cfg.MaxWidthPercentage / 100
row := p.Segments[rowNum]
rowLength := 0
if shellMaxLength > 0 {
for _, segment := range row {
rowLength += segment.Width
}
if rowLength > shellMaxLength && p.cfg.TruncateSegmentWidth > 0 {
minPriorityNotTruncated := MaxInteger
minPriorityNotTruncatedSegmentID := -1
for idx, segment := range row {
if segment.Width > p.cfg.TruncateSegmentWidth && segment.Priority < minPriorityNotTruncated {
minPriorityNotTruncated = segment.Priority
minPriorityNotTruncatedSegmentID = idx
}
}
for minPriorityNotTruncatedSegmentID != -1 && rowLength > shellMaxLength {
segment := row[minPriorityNotTruncatedSegmentID]
rowLength -= segment.Width
segment.Content = runewidth.Truncate(segment.Content, p.cfg.TruncateSegmentWidth-runewidth.StringWidth(segment.Separator)-3, "…")
segment.Width = segment.ComputeWidth(p.cfg.Condensed)
row = append(append(row[:minPriorityNotTruncatedSegmentID], segment), row[minPriorityNotTruncatedSegmentID+1:]...)
rowLength += segment.Width
minPriorityNotTruncated = MaxInteger
minPriorityNotTruncatedSegmentID = -1
for idx, segment := range row {
if segment.Width > p.cfg.TruncateSegmentWidth && segment.Priority < minPriorityNotTruncated {
minPriorityNotTruncated = segment.Priority
minPriorityNotTruncatedSegmentID = idx
}
}
}
}
for rowLength > shellMaxLength {
minPriority := MaxInteger
minPrioritySegmentID := -1
for idx, segment := range row {
if segment.Priority < minPriority {
minPriority = segment.Priority
minPrioritySegmentID = idx
}
}
if minPrioritySegmentID != -1 {
segment := row[minPrioritySegmentID]
row = append(row[:minPrioritySegmentID], row[minPrioritySegmentID+1:]...)
rowLength -= segment.Width
}
}
}
p.Segments[rowNum] = row
}
func (p *powerline) numEastAsianRunes(segmentContent *string) int {
if !p.cfg.EastAsianWidth {
return 0
}
numEastAsianRunes := 0
for _, r := range *segmentContent {
switch width.LookupRune(r).Kind() {
case width.EastAsianAmbiguous:
numEastAsianRunes++
case width.Neutral:
case width.EastAsianWide:
case width.EastAsianNarrow:
case width.EastAsianFullwidth:
case width.EastAsianHalfwidth:
}
}
return numEastAsianRunes
}
func (p *powerline) drawRow(rowNum int, buffer *bytes.Buffer) {
row := p.Segments[rowNum]
numEastAsianRunes := 0
// Prepend padding
if p.isRightPrompt() {
buffer.WriteRune(' ')
}
for idx, segment := range row {
if segment.HideSeparators {
buffer.WriteString(segment.Content)
continue
}
var separatorBackground string
if p.isRightPrompt() {
if idx == 0 {
separatorBackground = p.reset
} else {
prevSegment := row[idx-1]
separatorBackground = p.bgColor(prevSegment.Background)
}
buffer.WriteString(separatorBackground)
buffer.WriteString(p.fgColor(segment.SeparatorForeground))
buffer.WriteString(segment.Separator)
} else {
if idx >= len(row)-1 {
if !p.hasRightModules() || p.supportsRightModules() {
separatorBackground = p.reset
} else if p.hasRightModules() && rowNum >= len(p.Segments)-1 {
nextSegment := p.rightPowerline.Segments[0][0]
separatorBackground = p.bgColor(nextSegment.Background)
}
} else {
nextSegment := row[idx+1]
separatorBackground = p.bgColor(nextSegment.Background)
}
}
buffer.WriteString(p.fgColor(segment.Foreground))
buffer.WriteString(p.bgColor(segment.Background))
if !p.cfg.Condensed {
buffer.WriteRune(' ')
}
buffer.WriteString(segment.Content)
numEastAsianRunes += p.numEastAsianRunes(&segment.Content)
if !p.cfg.Condensed {
buffer.WriteRune(' ')
}
if !p.isRightPrompt() {
buffer.WriteString(separatorBackground)
buffer.WriteString(p.fgColor(segment.SeparatorForeground))
buffer.WriteString(segment.Separator)
}
buffer.WriteString(p.reset)
}
// Append padding before cursor for left-aligned prompts
if !p.isRightPrompt() || !p.hasRightModules() {
buffer.WriteRune(' ')
}
// Don't append padding for right-aligned modules
if !p.isRightPrompt() {
for i := 0; i < numEastAsianRunes; i++ {
buffer.WriteRune(' ')
}
}
}
func (p *powerline) draw() string {
var buffer bytes.Buffer
if p.cfg.Eval {
if p.align == alignLeft {
buffer.WriteString(p.shell.EvalPromptPrefix)
} else if p.supportsRightModules() {
buffer.WriteString(p.shell.EvalPromptRightPrefix)
}
}
for rowNum := range p.Segments {
p.truncateRow(rowNum)
p.drawRow(rowNum, &buffer)
if rowNum < len(p.Segments)-1 {
buffer.WriteRune('\n')
}
}
if p.cfg.PromptOnNewLine {
buffer.WriteRune('\n')
var foreground, background uint8
if p.cfg.PrevError == 0 || p.cfg.StaticPromptIndicator {
foreground = p.theme.CmdPassedFg
background = p.theme.CmdPassedBg
} else {
foreground = p.theme.CmdFailedFg
background = p.theme.CmdFailedBg
}
buffer.WriteString(p.fgColor(foreground))
buffer.WriteString(p.bgColor(background))
buffer.WriteString(p.shell.RootIndicator)
buffer.WriteString(p.reset)
buffer.WriteString(p.fgColor(background))
buffer.WriteString(p.symbols.Separator)
buffer.WriteString(p.reset)
buffer.WriteRune(' ')
}
if p.cfg.Eval {
switch p.align {
case alignLeft:
buffer.WriteString(p.shell.EvalPromptSuffix)
if p.supportsRightModules() {
buffer.WriteRune('\n')
if !p.hasRightModules() {
buffer.WriteString(p.shell.EvalPromptRightPrefix + p.shell.EvalPromptRightSuffix)
}
}
case alignRight:
if p.supportsRightModules() {
buffer.Truncate(buffer.Len() - 1)
buffer.WriteString(p.shell.EvalPromptRightSuffix)
}
}
if p.hasRightModules() {
buffer.WriteString(p.rightPowerline.draw())
}
}
return buffer.String()
}
func (p *powerline) hasRightModules() bool {
return p.rightPowerline != nil && len(p.rightPowerline.Segments[0]) > 0
}
func (p *powerline) supportsRightModules() bool {
return p.shell.EvalPromptRightPrefix != "" || p.shell.EvalPromptRightSuffix != ""
}
func (p *powerline) isRightPrompt() bool {
return p.align == alignRight && p.supportsRightModules()
}
powerline-go-1.25/powerline/ 0000775 0000000 0000000 00000000000 14634027167 0016066 5 ustar 00root root 0000000 0000000 powerline-go-1.25/powerline/powerline.go 0000664 0000000 0000000 00000002615 14634027167 0020425 0 ustar 00root root 0000000 0000000 package powerline
import (
runewidth "github.com/mattn/go-runewidth"
)
// Segment describes an information to display on the command line prompt
type Segment struct {
Name string
// Content is the text to be displayed on the command line prompt
Content string
// Foreground is the text color (see https://misc.flogisoft.com/bash/tip_colors_and_formatting#background1)
Foreground uint8
// Background is the color of the filling background (see https://misc.flogisoft.com/bash/tip_colors_and_formatting#background1)
Background uint8
// Separator is the character to be used when generating multiple segments to override the default separator
Separator string
// SeparatorForeground is the character to be used when generating multiple segments to override the default foreground separator
SeparatorForeground uint8
// Priority is the priority of the segment. The higher, the less probable the segment will be dropped if the total length is too long
Priority int
// HideSeparators indicated not to display any separator with next segment.
HideSeparators bool
Width int
// NewLine defines a newline segment to break the powerline in multi lines
NewLine bool
}
func (s Segment) ComputeWidth(condensed bool) int {
if condensed {
return runewidth.StringWidth(s.Content) + runewidth.StringWidth(s.Separator)
}
return runewidth.StringWidth(s.Content) + runewidth.StringWidth(s.Separator) + 2
}
powerline-go-1.25/powerline_test.go 0000664 0000000 0000000 00000001061 14634027167 0017452 0 ustar 00root root 0000000 0000000 package main
import "testing"
func Test_detectShell(t *testing.T) {
tests := []struct {
name string
want string
}{
{
name: "",
want: "bare",
},
{
name: "/bin/sh",
want: "bare",
}, {
name: "/bin/bash",
want: "bash",
}, {
name: "/usr/local/bin/bash5",
want: "bash",
}, {
name: "/usr/bin/zsh",
want: "zsh",
}}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := detectShell(tt.name); got != tt.want {
t.Errorf("detectShell(%q) = %q, want %q", tt.name, got, tt.want)
}
})
}
}
powerline-go-1.25/preview.png 0000664 0000000 0000000 00000267710 14634027167 0016266 0 ustar 00root root 0000000 0000000 PNG
IHDR . sBIT|d tEXtSoftware gnome-screenshot> IDATxw|Sdx ƀw d Ei467mス{Ii:FF03a
[B%Kd˖^G]t9:@0M %K @b Ż $&4] aĻ$ : & & & & &l.