pax_global_header00006660000000000000000000000064146340271670014524gustar00rootroot0000000000000052 comment=059f7f230760f8800307b3ae632c6cc6ca3f81d4 powerline-go-1.25/000077500000000000000000000000001463402716700140625ustar00rootroot00000000000000powerline-go-1.25/.editorconfig000066400000000000000000000002321463402716700165340ustar00rootroot00000000000000# 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/000077500000000000000000000000001463402716700154225ustar00rootroot00000000000000powerline-go-1.25/.github/ISSUE_TEMPLATE/000077500000000000000000000000001463402716700176055ustar00rootroot00000000000000powerline-go-1.25/.github/ISSUE_TEMPLATE/bug_report.md000066400000000000000000000012251463402716700222770ustar00rootroot00000000000000--- 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.md000066400000000000000000000011341463402716700233310ustar00rootroot00000000000000--- 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/000077500000000000000000000000001463402716700174575ustar00rootroot00000000000000powerline-go-1.25/.github/workflows/build.yml000066400000000000000000000011231463402716700212760ustar00rootroot00000000000000name: 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.yml000066400000000000000000000010661463402716700216250ustar00rootroot00000000000000name: 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/.gitignore000066400000000000000000000004721463402716700160550ustar00rootroot00000000000000# 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.yaml000066400000000000000000000011551463402716700171560ustar00rootroot00000000000000project_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.md000066400000000000000000000767041463402716700155040ustar00rootroot00000000000000### 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.md000066400000000000000000000402421463402716700153430ustar00rootroot00000000000000# 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. ![Solarized+Powerline](https://raw.github.com/justjanne/powerline-go/main/preview.png) - 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.go000066400000000000000000000225261463402716700153540ustar00rootroot00000000000000package 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.go000066400000000000000000000071731463402716700156660ustar00rootroot00000000000000package 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.go000066400000000000000000000744261463402716700162350ustar00rootroot00000000000000//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.go000066400000000000000000000002221463402716700167510ustar00rootroot00000000000000package main import "runtime" func homeEnvName() string { env := "HOME" if runtime.GOOS == "windows" { env = "USERPROFILE" } return env } powerline-go-1.25/exitcode/000077500000000000000000000000001463402716700156665ustar00rootroot00000000000000powerline-go-1.25/exitcode/exitcode_darwin.go000066400000000000000000000011311463402716700213610ustar00rootroot00000000000000package 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.go000066400000000000000000000011561463402716700220710ustar00rootroot00000000000000package 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.go000066400000000000000000000011751463402716700215170ustar00rootroot00000000000000package 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.go000066400000000000000000000011331463402716700212360ustar00rootroot00000000000000package 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.go000066400000000000000000000011521463402716700213570ustar00rootroot00000000000000package 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.go000066400000000000000000000011531463402716700215330ustar00rootroot00000000000000package 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.go000066400000000000000000000014001463402716700215500ustar00rootroot00000000000000package 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.go000066400000000000000000000001401463402716700215660ustar00rootroot00000000000000package exitcode var Signals = map[int]string{ // We don’t support named errors on Windows } powerline-go-1.25/exitcode/exitcode_zos.go000066400000000000000000000012201463402716700207070ustar00rootroot00000000000000package 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.sh000077500000000000000000000017611463402716700175620ustar00rootroot00000000000000#!/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.mod000066400000000000000000000005031463402716700151660ustar00rootroot00000000000000module 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.sum000066400000000000000000000143141463402716700152200ustar00rootroot00000000000000github.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.go000066400000000000000000000154001463402716700153350ustar00rootroot00000000000000package 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.go000066400000000000000000000271451463402716700164260ustar00rootroot00000000000000package 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/000077500000000000000000000000001463402716700160665ustar00rootroot00000000000000powerline-go-1.25/powerline/powerline.go000066400000000000000000000026151463402716700204250ustar00rootroot00000000000000package 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.go000066400000000000000000000010611463402716700174520ustar00rootroot00000000000000package 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.png000066400000000000000000002677101463402716700162660ustar00rootroot00000000000000PNG  IHDR.sBIT|dtEXtSoftwaregnome-screenshot> IDATxw|Sdxƀw d Ei467mス{Ii:F F03a [B%Kd˖^G]t9:@0M%K @b                                  Ż$&4] aĻ$ : & & & & &l.b&>@fFK@: &J@gM)( }#J q^ڶdl-;- J D[[g& 4Sklkh ᮏD`%ki(pHMD^֣cynFD% )xB밇cydA47p[Z7$t}9Һo+o3LAEiι-V--z\7ZGGI#ck!MX,t?i*}pC"i(itD %47`GkVжf#z]UQb E Pt~[{m;DM(\u0tH :xu'4M܏r>tF\[F@ڣy yXְ1 k%:tDiPrl{MkQmk Jsx o;(t:O $K$RQ?zFu8Nn>4MO{ A85t >҇(ėDu@@68v2J J8(M݀ޣy7,I'B')n(=QWWy @hOL뤮ʶ)fREGjtR*2]tԶZkvݳmij4M!IdAXm~+$jn]Yj*zf(jSt ̓T(Sұr;*E ~84JI TI JS"(Ի+ Qͮi]zkBn-f_ǐTIt]Z_z\N -%%Z0r<]RBW6H{bWF@ njj^CKQbh?  Fqo'ڳ\{n5\=ҲZuf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nM2u}>ks{:>)SRZR(sQngU:DصԴ(Ws (s2\)bL˥k"2=uRO?)O{K;zKRZJ8O=Knt\=C%>Dplψ$z!JoTVoqd+!Ja*>2n%^=|L-S(k@h//S_;%e{k^wFQZIk}J1J(e$qDpl *梎rkBV|RG(sQZsiy)QRZ^gqyJ9!ߊYRR?_.oO3۞Śn)&Gɯ=:|ǽӇ(-SSQ,SOE)|s9&([DD$Bc(־F:\t{_Qes"^k)>Zuxni= QYaz"gi- k5QȚu>ϷmwFoiXwyzI=ܾϟ{>^ڷ}1T!JDOkۣJ{mǟ\pl{(kc)Vy4@-g P2!ʊc"[&uISMZh ~BX> Qī Bc{ugރ%җ \pNdx-D';01&6y=Qa"\&(B@! !(axG^DBQ!D BBQ!D BBQ!D BBQ!D BBQ!D BBQ!D BBQ!D BBQ!D BBQ!D BBQ!D BBQ!D BBQ!D BBQ!D BBQ!D BqHMRIENDB`powerline-go-1.25/segment-aws.go000066400000000000000000000010061463402716700166400ustar00rootroot00000000000000package main import ( "os" pwl "github.com/justjanne/powerline-go/powerline" ) func segmentAWS(p *powerline) []pwl.Segment { profile := os.Getenv("AWS_PROFILE") region := os.Getenv("AWS_DEFAULT_REGION") if profile == "" { profile = os.Getenv("AWS_VAULT") if profile == "" { return []pwl.Segment{} } } var r string if region != "" { r = " (" + region + ")" } return []pwl.Segment{{ Name: "aws", Content: profile + r, Foreground: p.theme.AWSFg, Background: p.theme.AWSBg, }} } powerline-go-1.25/segment-bzr.go000066400000000000000000000030651463402716700166520ustar00rootroot00000000000000package main import ( "fmt" pwl "github.com/justjanne/powerline-go/powerline" "os/exec" "strings" ) func getBzrStatus() (bool, bool, bool) { hasModifiedFiles := false hasUntrackedFiles := false hasMissingFiles := false out, err := exec.Command("bzr", "status").Output() if err == nil { output := strings.Split(string(out), "\n") for _, line := range output { if line != "" { if line == "unknown:" { hasUntrackedFiles = true } else if line == "missing:" { hasMissingFiles = true } else { hasModifiedFiles = true } } } } return hasModifiedFiles, hasUntrackedFiles, hasMissingFiles } func segmentBzr(p *powerline) []pwl.Segment { out, _ := exec.Command("bzr", "nick").Output() output := strings.SplitN(string(out), "\n", 2) if len(output) > 0 && output[0] != "" { branch := output[0] hasModifiedFiles, hasUntrackedFiles, hasMissingFiles := getBzrStatus() var foreground, background uint8 var content string if hasModifiedFiles || hasUntrackedFiles || hasMissingFiles { foreground = p.theme.RepoDirtyFg background = p.theme.RepoDirtyBg extra := "" if hasUntrackedFiles { extra += "+" } if hasMissingFiles { extra += "!" } if hasUntrackedFiles { extra += "?" } content = fmt.Sprintf("%s %s", branch, extra) } else { foreground = p.theme.RepoCleanFg background = p.theme.RepoCleanBg content = branch } return []pwl.Segment{{ Name: "bzr", Content: content, Foreground: foreground, Background: background, }} } return []pwl.Segment{} } powerline-go-1.25/segment-cwd.go000066400000000000000000000152511463402716700166320ustar00rootroot00000000000000package main import ( "os" "sort" "strings" pwl "github.com/justjanne/powerline-go/powerline" ) const ellipsis = "\u2026" type pathSegment struct { path string home bool root bool ellipsis bool alias bool } type byRevLength []string func (s byRevLength) Len() int { return len(s) } func (s byRevLength) Swap(i, j int) { s[i], s[j] = s[j], s[i] } func (s byRevLength) Less(i, j int) bool { return len(s[i]) > len(s[j]) } func maybeAliasPathSegments(p *powerline, pathSegments []pathSegment) []pathSegment { pathSeparator := string(os.PathSeparator) if p.cfg.PathAliases == nil || len(p.cfg.PathAliases) == 0 { return pathSegments } keys := make([]string, len(p.cfg.PathAliases)) for k := range p.cfg.PathAliases { keys = append(keys, k) } sort.Sort(byRevLength(keys)) Aliases: for _, k := range keys { // This turns a string like "foo/bar/baz" into an array of strings. path := strings.Split(strings.Trim(k, pathSeparator), pathSeparator) // If the path has 3 elements, we know we should look at pathSegments // in 3-element chunks. size := len(path) // If there aren't that many segments in our path we can skip to the // next alias. if size > len(pathSegments) { continue Aliases } alias := p.cfg.PathAliases[k] Segments: // We want to see if that array of strings exists in pathSegments. for i := range pathSegments { // This is the upper index that we would look at. So if i is 0, // then we'd look at pathSegments[0,1,2], then [1,2,3], etc.. If i // is 2, we'd look at pathSegments[2,3,4] and so on. max := (i + size) - 1 // But if the upper index is out of bounds we can short-circuit // and move on to the next alias. if max > (len(pathSegments)-i)-1 { continue Aliases } // Then we loop over the indices in path and compare the // elements. If any element doesn't match we can move on to the // next index in pathSegments. for j := range path { if path[j] != pathSegments[i+j].path { continue Segments } } // They all matched! That means we can replace this slice with our // alias and skip to the next alias. pathSegments = append( pathSegments[:i], append( []pathSegment{{ path: alias, alias: true, }}, pathSegments[max+1:]..., )..., ) continue Aliases } } return pathSegments } func cwdToPathSegments(p *powerline, cwd string) []pathSegment { pathSeparator := string(os.PathSeparator) pathSegments := make([]pathSegment, 0) if cwd == p.userInfo.HomeDir { pathSegments = append(pathSegments, pathSegment{ path: "~", home: true, }) cwd = "" } else if strings.HasPrefix(cwd, p.userInfo.HomeDir+pathSeparator) { pathSegments = append(pathSegments, pathSegment{ path: "~", home: true, }) cwd = cwd[len(p.userInfo.HomeDir):] } else if cwd == pathSeparator { pathSegments = append(pathSegments, pathSegment{ path: pathSeparator, root: true, }) } cwd = strings.Trim(cwd, pathSeparator) names := strings.Split(cwd, pathSeparator) if names[0] == "" { names = names[1:] } for _, name := range names { pathSegments = append(pathSegments, pathSegment{ path: name, }) } return maybeAliasPathSegments(p, pathSegments) } func maybeShortenName(p *powerline, pathSegment string) string { if p.cfg.CwdMaxDirSize > 0 && len(pathSegment) > p.cfg.CwdMaxDirSize { return pathSegment[:p.cfg.CwdMaxDirSize] } return pathSegment } func escapeVariables(p *powerline, pathSegment string) string { pathSegment = strings.Replace(pathSegment, `\`, p.shell.EscapedBackslash, -1) pathSegment = strings.Replace(pathSegment, "`", p.shell.EscapedBacktick, -1) pathSegment = strings.Replace(pathSegment, `$`, p.shell.EscapedDollar, -1) return pathSegment } func getColor(p *powerline, pathSegment pathSegment, isLastDir bool) (uint8, uint8, bool) { if pathSegment.home && p.theme.HomeSpecialDisplay { return p.theme.HomeFg, p.theme.HomeBg, true } else if pathSegment.alias { return p.theme.AliasFg, p.theme.AliasBg, true } else if isLastDir { return p.theme.CwdFg, p.theme.PathBg, false } return p.theme.PathFg, p.theme.PathBg, false } func segmentCwd(p *powerline) (segments []pwl.Segment) { cwd := p.cwd switch p.cfg.CwdMode { case "plain": if strings.HasPrefix(cwd, p.userInfo.HomeDir) { cwd = "~" + cwd[len(p.userInfo.HomeDir):] } segments = append(segments, pwl.Segment{ Name: "cwd", Content: escapeVariables(p, cwd), Foreground: p.theme.CwdFg, Background: p.theme.PathBg, }) default: pathSegments := cwdToPathSegments(p, cwd) if p.cfg.CwdMode == "dironly" { pathSegments = pathSegments[len(pathSegments)-1:] } else { maxDepth := p.cfg.CwdMaxDepth if maxDepth <= 0 { warn("Ignoring -cwd-max-depth argument since it's smaller than or equal to 0") } else if len(pathSegments) > maxDepth { var nBefore int if maxDepth > 2 { nBefore = 2 } else { nBefore = maxDepth - 1 } firstPart := pathSegments[:nBefore] secondPart := pathSegments[len(pathSegments)+nBefore-maxDepth:] pathSegments = make([]pathSegment, 0) pathSegments = append(pathSegments, firstPart...) pathSegments = append(pathSegments, pathSegment{ path: ellipsis, ellipsis: true, }) pathSegments = append(pathSegments, secondPart...) } if p.cfg.CwdMode == "semifancy" && len(pathSegments) > 1 { var path string for idx, pathSegment := range pathSegments { if pathSegment.home || pathSegment.alias { continue } path += pathSegment.path if idx != len(pathSegments)-1 { path += string(os.PathSeparator) } } first := pathSegments[0] pathSegments = make([]pathSegment, 0) if first.home || first.alias { pathSegments = append(pathSegments, first) } pathSegments = append(pathSegments, pathSegment{ path: path, }) } } for idx, pathSegment := range pathSegments { isLastDir := idx == len(pathSegments)-1 foreground, background, special := getColor(p, pathSegment, isLastDir) segment := pwl.Segment{ Content: escapeVariables(p, maybeShortenName(p, pathSegment.path)), Foreground: foreground, Background: background, } if !special { if p.align == alignRight && p.supportsRightModules() && idx != 0 { segment.Separator = p.symbols.SeparatorReverseThin segment.SeparatorForeground = p.theme.SeparatorFg } else if (p.align == alignLeft || !p.supportsRightModules()) && !isLastDir { segment.Separator = p.symbols.SeparatorThin segment.SeparatorForeground = p.theme.SeparatorFg } } segment.Name = "cwd-path" if isLastDir { segment.Name = "cwd" } segments = append(segments, segment) } } return segments } powerline-go-1.25/segment-direnv.go000066400000000000000000000010001463402716700173270ustar00rootroot00000000000000package main import ( "os" "path/filepath" "strings" pwl "github.com/justjanne/powerline-go/powerline" ) func segmentDirenv(p *powerline) []pwl.Segment { content := os.Getenv("DIRENV_DIR") if content == "" { return []pwl.Segment{} } if strings.TrimPrefix(content, "-") == p.userInfo.HomeDir { content = "~" } else { content = filepath.Base(content) } return []pwl.Segment{{ Name: "direnv", Content: content, Foreground: p.theme.DotEnvFg, Background: p.theme.DotEnvBg, }} } powerline-go-1.25/segment-docker.go000066400000000000000000000012011463402716700173120ustar00rootroot00000000000000package main import ( "net/url" "os" pwl "github.com/justjanne/powerline-go/powerline" ) func segmentDocker(p *powerline) []pwl.Segment { var docker string dockerMachineName, _ := os.LookupEnv("DOCKER_MACHINE_NAME") dockerHost, _ := os.LookupEnv("DOCKER_HOST") if dockerMachineName != "" { docker = dockerMachineName } else if dockerHost != " " { u, err := url.Parse(dockerHost) if err == nil { docker = u.Host } } if docker == "" { return []pwl.Segment{} } return []pwl.Segment{{ Name: "docker", Content: docker, Foreground: p.theme.DockerMachineFg, Background: p.theme.DockerMachineBg, }} } powerline-go-1.25/segment-docker_context.go000066400000000000000000000022221463402716700210620ustar00rootroot00000000000000package main import ( "encoding/json" pwl "github.com/justjanne/powerline-go/powerline" "io/ioutil" "os" "path/filepath" ) type DockerContextConfig struct { CurrentContext string `json:"currentContext"` } func segmentDockerContext(p *powerline) []pwl.Segment { context := "default" home, _ := os.LookupEnv("HOME") contextFolder := filepath.Join(home, ".docker", "contexts") configFile := filepath.Join(home, ".docker", "config.json") contextEnvVar := os.Getenv("DOCKER_CONTEXT") if contextEnvVar != "" { context = contextEnvVar } else { stat, err := os.Stat(contextFolder) if err == nil && stat.IsDir() { dockerConfigFile, err := ioutil.ReadFile(configFile) if err == nil { var dockerConfig DockerContextConfig err = json.Unmarshal(dockerConfigFile, &dockerConfig) if err == nil && dockerConfig.CurrentContext != "" { context = dockerConfig.CurrentContext } } } } // Don’t show the default context if context == "default" { return []pwl.Segment{} } return []pwl.Segment{{ Name: "docker-context", Content: "🐳" + context, Foreground: p.theme.PlEnvFg, Background: p.theme.PlEnvBg, }} } powerline-go-1.25/segment-dotenv.go000066400000000000000000000007621463402716700173550ustar00rootroot00000000000000package main import ( "os" pwl "github.com/justjanne/powerline-go/powerline" ) func segmentDotEnv(p *powerline) []pwl.Segment { files := []string{".env", ".envrc"} dotEnv := false for _, file := range files { stat, err := os.Stat(file) if err == nil && !stat.IsDir() { dotEnv = true break } } if !dotEnv { return []pwl.Segment{} } return []pwl.Segment{{ Name: "dotenv", Content: "\u2235", Foreground: p.theme.DotEnvFg, Background: p.theme.DotEnvBg, }} } powerline-go-1.25/segment-duration.go000066400000000000000000000050711463402716700177010ustar00rootroot00000000000000package main import ( "fmt" "strconv" "strings" "time" pwl "github.com/justjanne/powerline-go/powerline" ) const ( micro rune = '\u00B5' milli rune = 'm' second rune = 's' minute rune = 'm' hour rune = 'h' ) const ( nanoseconds int64 = 1 microseconds int64 = nanoseconds * 1000 milliseconds int64 = microseconds * 1000 seconds int64 = milliseconds * 1000 minutes int64 = seconds * 60 hours int64 = minutes * 60 ) func segmentDuration(p *powerline) []pwl.Segment { if p.cfg.Duration == "" { return []pwl.Segment{{ Name: "duration", Content: "No duration", Foreground: p.theme.DurationFg, Background: p.theme.DurationBg, }} } durationValue := strings.Trim(p.cfg.Duration, "'\"") durationMinValue := strings.Trim(p.cfg.DurationMin, "'\"") hasPrecision := strings.Contains(durationValue, ".") durationFloat, err := strconv.ParseFloat(durationValue, 64) durationMinFloat, _ := strconv.ParseFloat(durationMinValue, 64) if err != nil { return []pwl.Segment{{ Name: "duration", Content: fmt.Sprintf("Failed to convert '%s' to a number", p.cfg.Duration), Foreground: p.theme.DurationFg, Background: p.theme.DurationBg, }} } if durationFloat < durationMinFloat { return []pwl.Segment{} } duration := time.Duration(durationFloat * float64(time.Second.Nanoseconds())) if duration <= 0 { return []pwl.Segment{} } var content string ns := duration.Nanoseconds() if ns > hours { hrs := ns / hours ns -= hrs * hours mins := ns / minutes content = fmt.Sprintf("%d%c %d%c", hrs, hour, mins, minute) } else if ns > minutes { mins := ns / minutes ns -= mins * minutes secs := ns / seconds content = fmt.Sprintf("%d%c %d%c", mins, minute, secs, second) } else if !hasPrecision { secs := ns / seconds content = fmt.Sprintf("%d%c", secs, second) } else if ns > seconds { secs := ns / seconds ns -= secs * seconds millis := ns / milliseconds content = fmt.Sprintf("%d%c %d%c%c", secs, second, millis, milli, second) } else if ns > milliseconds || p.cfg.DurationLowPrecision { millis := ns / milliseconds ns -= millis * milliseconds micros := ns / microseconds if p.cfg.DurationLowPrecision { content = fmt.Sprintf("%d%c%c", millis, milli, second) } else { content = fmt.Sprintf("%d%c%c %d%c%c", millis, milli, second, micros, micro, second) } } else { content = fmt.Sprintf("%d%c%c", ns/microseconds, micro, second) } return []pwl.Segment{{ Name: "duration", Content: content, Foreground: p.theme.DurationFg, Background: p.theme.DurationBg, }} } powerline-go-1.25/segment-exitcode.go000066400000000000000000000023371463402716700176620ustar00rootroot00000000000000package main import ( "fmt" "strconv" "github.com/justjanne/powerline-go/exitcode" pwl "github.com/justjanne/powerline-go/powerline" ) var exitCodes = map[int]string{ // 1: generic 1: "ERROR", // 2, 126, 127: common shell conventions, e.g. bash, zsh 2: "USAGE", 126: "NOEXEC", 127: "NOTFOUND", // 64-78: BSD, sysexits.h 64: "USAGE", 65: "DATAERR", 66: "NOINPUT", 67: "NOUSER", 68: "NOHOST", 69: "UNAVAILABLE", 70: "SOFTWARE", 71: "OSERR", 72: "OSFILE", 73: "CANTCREAT", 74: "IOERR", 75: "TEMPFAIL", 76: "PROTOCOL", 77: "NOPERM", 78: "CONFIG", } func getMeaningFromExitCode(exitCode int) string { if exitCode < 128 { name, ok := exitCodes[exitCode] if ok { return name } } else { name, ok := exitcode.Signals[exitCode-128] if ok { return name } } return fmt.Sprintf("%d", exitCode) } func segmentExitCode(p *powerline) []pwl.Segment { var meaning string if p.cfg.PrevError == 0 { return []pwl.Segment{} } if p.cfg.NumericExitCodes { meaning = strconv.Itoa(p.cfg.PrevError) } else { meaning = getMeaningFromExitCode(p.cfg.PrevError) } return []pwl.Segment{{ Name: "exit", Content: meaning, Foreground: p.theme.CmdFailedFg, Background: p.theme.CmdFailedBg, }} } powerline-go-1.25/segment-fossil.go000066400000000000000000000031771463402716700173600ustar00rootroot00000000000000package main import ( "fmt" pwl "github.com/justjanne/powerline-go/powerline" "os/exec" "strings" ) func getFossilStatus() (bool, bool, bool) { hasModifiedFiles := false hasUntrackedFiles := false hasMissingFiles := false out, err := exec.Command("fossil", "changes", "--differ").Output() if err == nil { output := strings.Split(string(out), "\n") for _, line := range output { if line != "" { if strings.HasPrefix(line, "EXTRA") { hasUntrackedFiles = true } else if strings.HasPrefix(line, "MISSING") { hasMissingFiles = true } else { hasModifiedFiles = true } } } } return hasModifiedFiles, hasUntrackedFiles, hasMissingFiles } func segmentFossil(p *powerline) []pwl.Segment { out, _ := exec.Command("fossil", "branch", "current").Output() output := strings.SplitN(string(out), "\n", 2) if len(output) > 0 && output[0] != "" { branch := output[0] hasModifiedFiles, hasUntrackedFiles, hasMissingFiles := getFossilStatus() var foreground, background uint8 var content string if hasModifiedFiles || hasUntrackedFiles || hasMissingFiles { foreground = p.theme.RepoDirtyFg background = p.theme.RepoDirtyBg extra := "" if hasUntrackedFiles { extra += "+" } if hasMissingFiles { extra += "!" } if hasUntrackedFiles { extra += "?" } content = fmt.Sprintf("%s %s", branch, extra) } else { foreground = p.theme.RepoCleanFg background = p.theme.RepoCleanBg content = branch } return []pwl.Segment{{ Name: "fossil", Content: content, Foreground: foreground, Background: background, }} } return []pwl.Segment{} } powerline-go-1.25/segment-gcp.go000066400000000000000000000053321463402716700166250ustar00rootroot00000000000000package main import ( "bytes" "fmt" "io/ioutil" "log" "os" "os/exec" "runtime" "strings" pwl "github.com/justjanne/powerline-go/powerline" ) const gcloudCoreSectionHeader = "\n[core]\n" func getCloudConfigDir() (string, error) { p, err := os.UserHomeDir() if err != nil { return "", err } if runtime.GOOS != "windows" { p += "/.config" } p += "/gcloud" return p, nil } func getActiveGCloudConfig(configDir string) (string, error) { activeConfigPath := configDir + "/active_config" stat, err := os.Stat(activeConfigPath) if (err == nil && os.IsNotExist(err)) || (err == nil && stat.IsDir()) { return "default", nil } else if err != nil { return "", err } contents, err := ioutil.ReadFile(activeConfigPath) if err != nil { return "", err } config := strings.TrimSpace(string(contents)) if config == "" { config = "default" } return config, nil } func getGCPProjectFromGCloud() (string, error) { out, err := exec.Command("gcloud", "config", "list", "project", "--format", "value(core.project)").Output() if err != nil { return "", err } return strings.TrimSuffix(string(out), "\n"), nil } func getGCPProjectFromFile() (string, error) { configDir, err := getCloudConfigDir() if err != nil { return "", err } activeConfig, err := getActiveGCloudConfig(configDir) if err != nil { return "", err } configPath := configDir + "/configurations/config_" + activeConfig stat, err := os.Stat(configPath) if err != nil { return "", err } else if stat.IsDir() { return "", fmt.Errorf("%s is a directory", configPath) } b, err := ioutil.ReadFile(configPath) if err != nil { return "", err } b = append([]byte("\n"), b...) coreStart := bytes.Index(b, []byte(gcloudCoreSectionHeader)) if coreStart == -1 { return "", fmt.Errorf("could not find [core] section in %s", configPath) } b = b[coreStart+len(gcloudCoreSectionHeader):] coreEnd := bytes.Index(b, []byte("\n[")) if coreEnd != -1 { b = b[:coreEnd] } lines := bytes.Split(b[coreStart+len(gcloudCoreSectionHeader):coreEnd], []byte("\n")) for _, line := range lines { parts := bytes.Split(line, []byte("=")) if len(parts) == 2 { if strings.TrimSpace(string(parts[0])) == "project" { return strings.TrimSpace(string(parts[1])), nil } } } return "", nil } func getGCPProject() (string, error) { if project, err := getGCPProjectFromFile(); err == nil { return project, nil } else { return getGCPProjectFromGCloud() } } func segmentGCP(p *powerline) []pwl.Segment { project, err := getGCPProject() if err != nil { log.Fatal(err) } if project == "" { return []pwl.Segment{} } return []pwl.Segment{{ Name: "gcp", Content: project, Foreground: p.theme.GCPFg, Background: p.theme.GCPBg, }} } powerline-go-1.25/segment-git.go000066400000000000000000000165431463402716700166450ustar00rootroot00000000000000package main import ( "fmt" "os" "os/exec" "path" "regexp" "strconv" "strings" pwl "github.com/justjanne/powerline-go/powerline" ) type repoStats struct { ahead int behind int untracked int notStaged int staged int conflicted int stashed int } func (r repoStats) dirty() bool { return r.untracked+r.notStaged+r.staged+r.conflicted > 0 } func (r repoStats) any() bool { return r.ahead+r.behind+r.untracked+r.notStaged+r.staged+r.conflicted+r.stashed > 0 } func addRepoStatsSegment(nChanges int, symbol string, foreground uint8, background uint8) []pwl.Segment { if nChanges > 0 { return []pwl.Segment{{ Name: "git-status", Content: fmt.Sprintf("%d%s", nChanges, symbol), Foreground: foreground, Background: background, }} } return []pwl.Segment{} } func (r repoStats) GitSegments(p *powerline) (segments []pwl.Segment) { segments = append(segments, addRepoStatsSegment(r.ahead, p.symbols.RepoAhead, p.theme.GitAheadFg, p.theme.GitAheadBg)...) segments = append(segments, addRepoStatsSegment(r.behind, p.symbols.RepoBehind, p.theme.GitBehindFg, p.theme.GitBehindBg)...) segments = append(segments, addRepoStatsSegment(r.staged, p.symbols.RepoStaged, p.theme.GitStagedFg, p.theme.GitStagedBg)...) segments = append(segments, addRepoStatsSegment(r.notStaged, p.symbols.RepoNotStaged, p.theme.GitNotStagedFg, p.theme.GitNotStagedBg)...) segments = append(segments, addRepoStatsSegment(r.untracked, p.symbols.RepoUntracked, p.theme.GitUntrackedFg, p.theme.GitUntrackedBg)...) segments = append(segments, addRepoStatsSegment(r.conflicted, p.symbols.RepoConflicted, p.theme.GitConflictedFg, p.theme.GitConflictedBg)...) segments = append(segments, addRepoStatsSegment(r.stashed, p.symbols.RepoStashed, p.theme.GitStashedFg, p.theme.GitStashedBg)...) return } func addRepoStatsSymbol(nChanges int, symbol string, GitMode string) string { if nChanges > 0 { if GitMode == "simple" { return symbol } else if GitMode == "compact" { return fmt.Sprintf(" %d%s", nChanges, symbol ) } else { return symbol } } return "" } func (r repoStats) GitSymbols(p *powerline) string { var info string info += addRepoStatsSymbol(r.ahead, p.symbols.RepoAhead, p.cfg.GitMode) info += addRepoStatsSymbol(r.behind, p.symbols.RepoBehind, p.cfg.GitMode) info += addRepoStatsSymbol(r.staged, p.symbols.RepoStaged, p.cfg.GitMode) info += addRepoStatsSymbol(r.notStaged, p.symbols.RepoNotStaged, p.cfg.GitMode) info += addRepoStatsSymbol(r.untracked, p.symbols.RepoUntracked, p.cfg.GitMode) info += addRepoStatsSymbol(r.conflicted, p.symbols.RepoConflicted, p.cfg.GitMode) info += addRepoStatsSymbol(r.stashed, p.symbols.RepoStashed, p.cfg.GitMode) return info } var branchRegex = regexp.MustCompile(`^## (?P\S+?)(\.{3}(?P\S+?)( \[(ahead (?P\d+)(, )?)?(behind (?P\d+))?])?)?$`) func groupDict(pattern *regexp.Regexp, haystack string) map[string]string { match := pattern.FindStringSubmatch(haystack) result := make(map[string]string) if len(match) > 0 { for i, name := range pattern.SubexpNames() { if i != 0 { result[name] = match[i] } } } return result } var gitProcessEnv = func() []string { homeEnv := homeEnvName() home, _ := os.LookupEnv(homeEnv) path, _ := os.LookupEnv("PATH") env := map[string]string{ "LANG": "C", homeEnv: home, "PATH": path, } result := make([]string, 0) for key, value := range env { result = append(result, fmt.Sprintf("%s=%s", key, value)) } return result }() func runGitCommand(cmd string, args ...string) (string, error) { command := exec.Command(cmd, args...) command.Env = gitProcessEnv out, err := command.Output() return string(out), err } func parseGitBranchInfo(status []string) map[string]string { return groupDict(branchRegex, status[0]) } func getGitDetachedBranch(p *powerline) string { out, err := runGitCommand("git", "--no-optional-locks", "rev-parse", "--short", "HEAD") if err != nil { out, err := runGitCommand("git", "--no-optional-locks", "symbolic-ref", "--short", "HEAD") if err != nil { return "Error" } return strings.SplitN(out, "\n", 2)[0] } detachedRef := strings.SplitN(out, "\n", 2) return fmt.Sprintf("%s %s", p.symbols.RepoDetached, detachedRef[0]) } func parseGitStats(status []string) repoStats { stats := repoStats{} if len(status) > 1 { for _, line := range status[1:] { if len(line) > 2 { code := line[:2] switch code { case "??": stats.untracked++ case "DD", "AU", "UD", "UA", "DU", "AA", "UU": stats.conflicted++ default: if code[0] != ' ' { stats.staged++ } if code[1] != ' ' { stats.notStaged++ } } } } } return stats } func repoRoot(path string) (string, error) { out, err := runGitCommand("git", "--no-optional-locks", "rev-parse", "--show-toplevel") if err != nil { return "", err } return strings.TrimSpace(out), nil } func indexSize(root string) (int64, error) { fileInfo, err := os.Stat(path.Join(root, ".git", "index")) if err != nil { return 0, err } return fileInfo.Size(), nil } func segmentGit(p *powerline) []pwl.Segment { repoRoot, err := repoRoot(p.cwd) if err != nil { return []pwl.Segment{} } if len(p.ignoreRepos) > 0 && p.ignoreRepos[repoRoot] { return []pwl.Segment{} } args := []string{ "--no-optional-locks", "status", "--porcelain", "-b", "--ignore-submodules", } if p.cfg.GitAssumeUnchangedSize > 0 { indexSize, _ := indexSize(p.cwd) if indexSize > (p.cfg.GitAssumeUnchangedSize * 1024) { args = append(args, "-uno") } } out, err := runGitCommand("git", args...) if err != nil { return []pwl.Segment{} } status := strings.Split(out, "\n") stats := parseGitStats(status) branchInfo := parseGitBranchInfo(status) var branch string if branchInfo["local"] != "" { ahead, _ := strconv.ParseInt(branchInfo["ahead"], 10, 32) stats.ahead = int(ahead) behind, _ := strconv.ParseInt(branchInfo["behind"], 10, 32) stats.behind = int(behind) branch = branchInfo["local"] } else { branch = getGitDetachedBranch(p) } if len(p.symbols.RepoBranch) > 0 { branch = fmt.Sprintf("%s %s", p.symbols.RepoBranch, branch) } var foreground, background uint8 if stats.dirty() { foreground = p.theme.RepoDirtyFg background = p.theme.RepoDirtyBg } else { foreground = p.theme.RepoCleanFg background = p.theme.RepoCleanBg } segments := []pwl.Segment{{ Name: "git-branch", Content: branch, Foreground: foreground, Background: background, }} stashEnabled := true for _, stat := range p.cfg.GitDisableStats { // "ahead, behind, staged, notStaged, untracked, conflicted, stashed" switch stat { case "ahead": stats.ahead = 0 case "behind": stats.behind = 0 case "staged": stats.staged = 0 case "notStaged": stats.notStaged = 0 case "untracked": stats.untracked = 0 case "conflicted": stats.conflicted = 0 case "stashed": stats.stashed = 0 stashEnabled = false } } if stashEnabled { out, err = runGitCommand("git", "--no-optional-locks", "rev-list", "-g", "refs/stash") if err == nil { stats.stashed = strings.Count(out, "\n") } } if p.cfg.GitMode == "simple" { if stats.any() { segments[0].Content += " " + stats.GitSymbols(p) } } else if p.cfg.GitMode == "compact" { if stats.any() { segments[0].Content += stats.GitSymbols(p) } } else { // fancy segments = append(segments, stats.GitSegments(p)...) } return segments } powerline-go-1.25/segment-gitlite.go000066400000000000000000000017121463402716700175130ustar00rootroot00000000000000package main import ( "fmt" "strings" pwl "github.com/justjanne/powerline-go/powerline" ) func segmentGitLite(p *powerline) []pwl.Segment { if len(p.ignoreRepos) > 0 { out, err := runGitCommand("git", "--no-optional-locks", "rev-parse", "--show-toplevel") if err != nil { return []pwl.Segment{} } out = strings.TrimSpace(out) if p.ignoreRepos[out] { return []pwl.Segment{} } } out, err := runGitCommand("git", "--no-optional-locks", "rev-parse", "--abbrev-ref", "HEAD") if err != nil { return []pwl.Segment{} } status := strings.TrimSpace(out) var branch string if status == "HEAD" { branch = getGitDetachedBranch(p) } else { branch = status } if p.cfg.GitMode != "compact" && len(p.symbols.RepoBranch) > 0 { branch = fmt.Sprintf("%s %s", p.symbols.RepoBranch, branch) } return []pwl.Segment{{ Name: "git-branch", Content: branch, Foreground: p.theme.RepoCleanFg, Background: p.theme.RepoCleanBg, }} } powerline-go-1.25/segment-goenv.go000066400000000000000000000047311463402716700171740ustar00rootroot00000000000000package main import ( "fmt" pwl "github.com/justjanne/powerline-go/powerline" "io/ioutil" "os" "os/exec" "path/filepath" "strings" ) const goenvVersionFileSuffix = "/.go-version" const goenvVersionEnvVar = "GOENV_VERSION" const goenvGlobalVersionFileSuffix = "/.goenv/version" func runGoenvCommand(cmd string, args ...string) (string, error) { command := exec.Command(cmd, args...) out, err := command.Output() return string(out), err } // check GOENV_VERSION variable func checkEnvForGoenvVersion() (string, error) { goenvVersion := os.Getenv(goenvVersionEnvVar) if len(goenvVersion) > 0 { return goenvVersion, nil } else { return "", fmt.Errorf("Not found in %s", goenvVersionEnvVar) } } // check existence of .go-version in tree until root path func checkForGoVersionFileInTree() (string, error) { var ( workingDirectory string err error ) workingDirectory, err = os.Getwd() if err == nil { for workingDirectory != "/" { goVersion, goVersionErr := ioutil.ReadFile(workingDirectory + goenvVersionFileSuffix) if goVersionErr == nil { return strings.TrimSpace(string(goVersion)), nil } workingDirectory = filepath.Dir(workingDirectory) } } return "", fmt.Errorf("No %s file found in tree", goenvVersionFileSuffix) } // check for global version func checkForGoenvGlobalVersion() (string, error) { homeDir, _ := os.UserHomeDir() globalGoVersion, err := ioutil.ReadFile(homeDir + goenvGlobalVersionFileSuffix) if err == nil { return strings.TrimSpace(string(globalGoVersion)), nil } else { return "", fmt.Errorf("No global go version file found in %s", homeDir+goenvGlobalVersionFileSuffix) } } // retrieve goenv version output func checkForGoenvOutput() (string, error) { // spawn goenv and print out version out, err := runGoenvCommand("goenv", "version") if err == nil { items := strings.Split(out, " ") if len(items) > 1 { return items[0], nil } } return "", fmt.Errorf("Not found in goenv object") } func segmentGoenv(p *powerline) []pwl.Segment { global, _ := checkForGoenvGlobalVersion() segment, err := checkEnvForGoenvVersion() if err != nil || segment == global { segment, err = checkForGoVersionFileInTree() } if err != nil || segment == global { segment, err = checkForGoenvOutput() } if err != nil || segment == global { return []pwl.Segment{} } else { return []pwl.Segment{{ Name: "goenv", Content: segment, Foreground: p.theme.GoenvFg, Background: p.theme.GoenvBg, }} } } powerline-go-1.25/segment-hg.go000066400000000000000000000027431463402716700164550ustar00rootroot00000000000000package main import ( "fmt" "os/exec" "strings" pwl "github.com/justjanne/powerline-go/powerline" ) func getHgStatus() (bool, bool, bool) { hasModifiedFiles := false hasUntrackedFiles := false hasMissingFiles := false out, err := exec.Command("hg", "status").Output() if err == nil { output := strings.Split(string(out), "\n") for _, line := range output { if line != "" { if line[0] == '?' { hasUntrackedFiles = true } else if line[0] == '!' { hasMissingFiles = true } else { hasModifiedFiles = true } } } } return hasModifiedFiles, hasUntrackedFiles, hasMissingFiles } func segmentHg(p *powerline) []pwl.Segment { out, _ := exec.Command("hg", "branch").Output() output := strings.SplitN(string(out), "\n", 2) if !(len(output) > 0 && output[0] != "") { return []pwl.Segment{} } branch := output[0] hasModifiedFiles, hasUntrackedFiles, hasMissingFiles := getHgStatus() var foreground, background uint8 var content string if hasModifiedFiles || hasUntrackedFiles || hasMissingFiles { foreground = p.theme.RepoDirtyFg background = p.theme.RepoDirtyBg extra := "" if hasUntrackedFiles { extra += "+" } if hasMissingFiles { extra += "!" } content = fmt.Sprintf("%s %s", branch, extra) } else { foreground = p.theme.RepoCleanFg background = p.theme.RepoCleanBg content = branch } return []pwl.Segment{{ Name: "hg", Content: content, Foreground: foreground, Background: background, }} } powerline-go-1.25/segment-hostname.go000066400000000000000000000027521463402716700176750ustar00rootroot00000000000000package main import ( "crypto/md5" pwl "github.com/justjanne/powerline-go/powerline" "os" "strconv" "strings" ) func getHostName(fullyQualifiedDomainName string) string { return strings.SplitN(fullyQualifiedDomainName, ".", 2)[0] } func getMd5(text string) []byte { hasher := md5.New() hasher.Write([]byte(text)) return hasher.Sum(nil) } func segmentHost(p *powerline) []pwl.Segment { var hostPrompt string var foreground, background uint8 if p.cfg.HostnameOnlyIfSSH { if os.Getenv("SSH_CLIENT") == "" { // It's not an ssh connection do nothing return []pwl.Segment{} } } if p.cfg.ColorizeHostname { hostName := getHostName(p.hostname) hostPrompt = hostName foregroundEnv, foregroundEnvErr := strconv.ParseUint(os.Getenv("PLGO_HOSTNAMEFG"), 0, 8) backgroundEnv, backgroundEnvErr := strconv.ParseUint(os.Getenv("PLGO_HOSTNAMEBG"), 0, 8) if foregroundEnvErr == nil && backgroundEnvErr == nil { foreground = uint8(foregroundEnv) background = uint8(backgroundEnv) } else { hash := getMd5(hostName) background = hash[0] % 128 foreground = p.theme.HostnameColorizedFgMap[background] } } else { if p.cfg.Shell == "bash" { hostPrompt = "\\h" } else if p.cfg.Shell == "zsh" { hostPrompt = "%m" } else { hostPrompt = getHostName(p.hostname) } foreground = p.theme.HostnameFg background = p.theme.HostnameBg } return []pwl.Segment{{ Name: "host", Content: hostPrompt, Foreground: foreground, Background: background, }} } powerline-go-1.25/segment-jobs.go000066400000000000000000000005221463402716700170050ustar00rootroot00000000000000package main import ( "strconv" pwl "github.com/justjanne/powerline-go/powerline" ) func segmentJobs(p *powerline) []pwl.Segment { if p.cfg.Jobs <= 0 { return []pwl.Segment{} } return []pwl.Segment{{ Name: "jobs", Content: strconv.Itoa(p.cfg.Jobs), Foreground: p.theme.JobsFg, Background: p.theme.JobsBg, }} } powerline-go-1.25/segment-kube.go000066400000000000000000000067661463402716700170160ustar00rootroot00000000000000package main import ( "fmt" pwl "github.com/justjanne/powerline-go/powerline" "io/ioutil" "os" "path" "path/filepath" "regexp" "strings" "gopkg.in/yaml.v2" ) // KubeContext holds the kubernetes context type KubeContext struct { Context struct { Cluster string Namespace string User string } Name string } // KubeConfig is the kubernetes configuration type KubeConfig struct { Contexts []KubeContext `yaml:"contexts"` CurrentContext string `yaml:"current-context"` } func homePath() string { return os.Getenv(homeEnvName()) } func readKubeConfig(config *KubeConfig, path string) (err error) { absolutePath, err := filepath.Abs(path) if err != nil { return } fileContent, err := ioutil.ReadFile(absolutePath) if err != nil { return } err = yaml.Unmarshal(fileContent, config) if err != nil { return } return } func segmentKube(p *powerline) []pwl.Segment { paths := append(strings.Split(os.Getenv("KUBECONFIG"), ":"), path.Join(homePath(), ".kube", "config")) config := &KubeConfig{} for _, configPath := range paths { temp := &KubeConfig{} if readKubeConfig(temp, configPath) == nil { config.Contexts = append(config.Contexts, temp.Contexts...) if config.CurrentContext == "" { config.CurrentContext = temp.CurrentContext } } } cluster := "" namespace := "" for _, context := range config.Contexts { if context.Name == config.CurrentContext { cluster = context.Name namespace = context.Context.Namespace break } } // When you use gke your clusters may look something like gke_projectname_availability-zone_cluster-01 // instead I want it to read as `cluster-01` // So we remove the first 3 segments of this string, if the flag is set, and there are enough segments if strings.HasPrefix(cluster, "gke") && p.cfg.ShortenGKENames { segments := strings.Split(cluster, "_") if len(segments) > 3 { cluster = strings.Join(segments[3:], "_") } } // When you use openshift your clusters may look something like namespace/portal-url:port/user, // instead I want it to read as `portal-url`. // So we ensure there are three segments split by / and then choose the middle part, // we also remove the port number from the result. if p.cfg.ShortenOpenshiftNames { segments := strings.Split(cluster, "/") if len(segments) == 3 { cluster = segments[1] idx := strings.IndexByte(cluster, ':') if idx != -1 { cluster = cluster[0:idx] } } } // With AWS EKS, cluster names are ARNs; it makes more sense to shorten them // so "eks-infra" instead of "arn:aws:eks:us-east-1:XXXXXXXXXXXX:cluster/eks-infra const arnRegexString string = "^arn:aws:eks:[[:alnum:]-]+:[[:digit:]]+:cluster/(.*)$" arnRe := regexp.MustCompile(arnRegexString) if arnMatches := arnRe.FindStringSubmatch(cluster); arnMatches != nil && p.cfg.ShortenEKSNames { cluster = arnMatches[1] } segments := []pwl.Segment{} // Only draw the icon once kubeIconHasBeenDrawnYet := false if cluster != "" { kubeIconHasBeenDrawnYet = true segments = append(segments, pwl.Segment{ Name: "kube-cluster", Content: fmt.Sprintf("⎈ %s", cluster), Foreground: p.theme.KubeClusterFg, Background: p.theme.KubeClusterBg, }) } if namespace != "" { content := namespace if !kubeIconHasBeenDrawnYet { content = fmt.Sprintf("⎈ %s", content) } segments = append(segments, pwl.Segment{ Name: "kube-namespace", Content: content, Foreground: p.theme.KubeNamespaceFg, Background: p.theme.KubeNamespaceBg, }) } return segments } powerline-go-1.25/segment-load.go000066400000000000000000000011571463402716700167740ustar00rootroot00000000000000package main import ( "fmt" pwl "github.com/justjanne/powerline-go/powerline" "runtime" "github.com/shirou/gopsutil/v3/load" ) func segmentLoad(p *powerline) []pwl.Segment { c := runtime.NumCPU() a, err := load.Avg() if err != nil { return []pwl.Segment{} } bg := p.theme.LoadBg load := a.Load5 switch p.theme.LoadAvgValue { case 1: load = a.Load1 case 15: load = a.Load15 } if load > float64(c)*p.theme.LoadThresholdBad { bg = p.theme.LoadHighBg } return []pwl.Segment{{ Name: "load", Content: fmt.Sprintf("%.2f", a.Load5), Foreground: p.theme.LoadFg, Background: bg, }} } powerline-go-1.25/segment-newline.go000066400000000000000000000002431463402716700175110ustar00rootroot00000000000000package main import pwl "github.com/justjanne/powerline-go/powerline" func segmentNewline(p *powerline) []pwl.Segment { return []pwl.Segment{{NewLine: true}} } powerline-go-1.25/segment-nix-shell.go000066400000000000000000000006151463402716700177560ustar00rootroot00000000000000package main import ( pwl "github.com/justjanne/powerline-go/powerline" "os" ) func segmentNixShell(p *powerline) []pwl.Segment { var nixShell string nixShell, _ = os.LookupEnv("IN_NIX_SHELL") if nixShell == "" { return []pwl.Segment{} } return []pwl.Segment{{ Name: "nix-shell", Content: "\uf313", Foreground: p.theme.NixShellFg, Background: p.theme.NixShellBg, }} } powerline-go-1.25/segment-node.go000066400000000000000000000025341463402716700170020ustar00rootroot00000000000000package main import ( "encoding/json" "io/ioutil" "os" "os/exec" "strings" pwl "github.com/justjanne/powerline-go/powerline" ) const pkgfile = "./package.json" type packageJSON struct { Version string `json:"version"` } func getNodeVersion() string { out, err := exec.Command("node", "--version").Output() if err != nil { return "" } return strings.TrimSuffix(string(out), "\n") } func getPackageVersion() string { stat, err := os.Stat(pkgfile) if err != nil { return "" } if stat.IsDir() { return "" } pkg := packageJSON{""} raw, err := ioutil.ReadFile(pkgfile) if err != nil { return "" } err = json.Unmarshal(raw, &pkg) if err != nil { return "" } return strings.TrimSpace(pkg.Version) } func segmentNode(p *powerline) []pwl.Segment { nodeVersion := getNodeVersion() packageVersion := getPackageVersion() segments := []pwl.Segment{} if nodeVersion != "" { segments = append(segments, pwl.Segment{ Name: "node", Content: p.symbols.NodeIndicator + " " + nodeVersion, Foreground: p.theme.NodeVersionFg, Background: p.theme.NodeVersionBg, }) } if packageVersion != "" { segments = append(segments, pwl.Segment{ Name: "node-segment", Content: packageVersion + " " + p.symbols.NodeIndicator, Foreground: p.theme.NodeFg, Background: p.theme.NodeBg, }) } return segments } powerline-go-1.25/segment-perlbrew.go000066400000000000000000000006221463402716700176730ustar00rootroot00000000000000package main import ( pwl "github.com/justjanne/powerline-go/powerline" "os" "path" ) func segmentPerlbrew(p *powerline) []pwl.Segment { env, _ := os.LookupEnv("PERLBREW_PERL") if env == "" { return []pwl.Segment{} } envName := path.Base(env) return []pwl.Segment{{ Name: "perlbrew", Content: envName, Foreground: p.theme.PerlbrewFg, Background: p.theme.PerlbrewBg, }} } powerline-go-1.25/segment-plenv.go000066400000000000000000000005371463402716700172020ustar00rootroot00000000000000package main import ( "os" pwl "github.com/justjanne/powerline-go/powerline" ) func segmentPlEnv(p *powerline) []pwl.Segment { env, _ := os.LookupEnv("PLENV_VERSION") if env == "" { return []pwl.Segment{} } return []pwl.Segment{{ Name: "plenv", Content: env, Foreground: p.theme.PlEnvFg, Background: p.theme.PlEnvBg, }} } powerline-go-1.25/segment-plugin.go000066400000000000000000000007601463402716700173520ustar00rootroot00000000000000package main import ( "encoding/json" "os/exec" pwl "github.com/justjanne/powerline-go/powerline" ) func segmentPlugin(p *powerline, plugin string) ([]pwl.Segment, bool) { output, err := exec.Command("powerline-go-" + plugin).Output() if err != nil { return nil, false } segments := []pwl.Segment{} err = json.Unmarshal(output, &segments) if err != nil { // The plugin was found but no valid data was returned. Ignore it return []pwl.Segment{}, true } return segments, true } powerline-go-1.25/segment-rbenv.go000066400000000000000000000045751463402716700172000ustar00rootroot00000000000000package main import ( "errors" "io/ioutil" "os" "os/exec" "path/filepath" "strings" pwl "github.com/justjanne/powerline-go/powerline" ) const rubyVersionFileSuffix = "/.ruby-version" const globalVersionFileSuffix = "/.rbenv/version" func runRbenvCommand(cmd string, args ...string) (string, error) { command := exec.Command(cmd, args...) out, err := command.Output() return string(out), err } // check RBENV_VERSION variable func checkEnvForRbenvVersion() (string, error) { rbenvVersion := os.Getenv("RBENV_VERSION") if len(rbenvVersion) <= 0 { return "", errors.New("Not found in RBENV_VERSION") } return rbenvVersion, nil } // check existence of .ruby_version in tree until root path func checkForRubyVersionFileInTree() (string, error) { var ( workingDirectory string err error ) workingDirectory, err = os.Getwd() if err == nil { for workingDirectory != "/" { rubyVersion, rubyVersionErr := ioutil.ReadFile(workingDirectory + rubyVersionFileSuffix) if rubyVersionErr == nil { return strings.TrimSpace(string(rubyVersion)), nil } workingDirectory = filepath.Dir(workingDirectory) } } return "", errors.New("No .ruby_version file found in tree") } // check for global version func checkForGlobalVersion() (string, error) { homeDir, _ := os.UserHomeDir() globalRubyVersion, err := ioutil.ReadFile(homeDir + globalVersionFileSuffix) if err != nil { return "", errors.New("No global version file found in tree") } return strings.TrimSpace(string(globalRubyVersion)), nil } // retrieve rbenv version output func checkForRbenvOutput() (string, error) { // spawn rbenv and print out version out, err := runRbenvCommand("rbenv", "version") if err != nil { return "", errors.New("Not found in rbenv output") } items := strings.Split(out, " ") if len(items) <= 0 { return "", errors.New("Not found in rbenv output") } return items[0], nil } func segmentRbenv(p *powerline) []pwl.Segment { var ( segment string err error ) segment, err = checkEnvForRbenvVersion() if err != nil { segment, err = checkForRubyVersionFileInTree() } if err != nil { segment, err = checkForGlobalVersion() } if err != nil { segment, err = checkForRbenvOutput() } if err != nil { return []pwl.Segment{} } return []pwl.Segment{{ Name: "rbenv", Content: segment, Foreground: p.theme.TimeFg, Background: p.theme.TimeBg, }} } powerline-go-1.25/segment-readonly.go000066400000000000000000000006241463402716700176700ustar00rootroot00000000000000// +build !windows package main import ( pwl "github.com/justjanne/powerline-go/powerline" "golang.org/x/sys/unix" ) func segmentPerms(p *powerline) []pwl.Segment { cwd := p.cwd if unix.Access(cwd, unix.W_OK) == nil { return []pwl.Segment{} } return []pwl.Segment{{ Name: "perms", Content: p.symbols.Lock, Foreground: p.theme.ReadonlyFg, Background: p.theme.ReadonlyBg, }} } powerline-go-1.25/segment-readonly_windows.go000066400000000000000000000007761463402716700214520ustar00rootroot00000000000000// +build windows package main import ( "os" pwl "github.com/justjanne/powerline-go/powerline" ) func segmentPerms(p *powerline) []pwl.Segment { cwd := p.cwd const W_USR = 0002 // Check user's permissions on directory in a portable but probably slower way fileInfo, _ := os.Stat(cwd) if fileInfo.Mode()&W_USR == W_USR { return []pwl.Segment{} } return []pwl.Segment{{ Name: "perms", Content: p.symbols.Lock, Foreground: p.theme.ReadonlyFg, Background: p.theme.ReadonlyBg, }} } powerline-go-1.25/segment-root.go000066400000000000000000000007721463402716700170420ustar00rootroot00000000000000package main import pwl "github.com/justjanne/powerline-go/powerline" func segmentRoot(p *powerline) []pwl.Segment { 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 } return []pwl.Segment{{ Name: "root", Content: p.shell.RootIndicator, Foreground: foreground, Background: background, }} } powerline-go-1.25/segment-rvm.go000066400000000000000000000040771463402716700166650ustar00rootroot00000000000000package main import ( "errors" "os" "os/exec" "strings" pwl "github.com/justjanne/powerline-go/powerline" ) func runRvmCommand(cmd string, args ...string) (string, error) { command := exec.Command(cmd, args...) out, err := command.Output() return string(out), err } // check RUBY_VERSION variable func checkEnvForRubyVersion() (string, error) { rubyVersion := os.Getenv("RUBY_VERSION") if len(rubyVersion) <= 0 { return "", errors.New("Not found in RUBY_VERSION") } return rubyVersion, nil } // check GEM_HOME variable for gemset information func checkEnvForRubyGemset() (string, error) { gemHomeSegments := strings.Split(os.Getenv("GEM_HOME"), "@") if len(gemHomeSegments) <= 1 { return "", errors.New("Gemset not found in GEM_HOME") } return gemHomeSegments[1], nil } // retrieve ruby version from RVM func checkForRvmOutput() (string, error) { // ask RVM what the current ruby version is out, err := runRvmCommand("rvm", "current") if err != nil { return "", errors.New("Not found in RVM output") } items := strings.Split(out, " ") if len(items) <= 0 { return "", errors.New("Not found in RVM output") } return items[0], nil } func segmentRvm(p *powerline) []pwl.Segment { var ( segment string err error ) segment, err = checkEnvForRubyVersion() if err != nil { segment, err = checkForRubyVersionFileInTree() } if err != nil { segment, err = checkForRvmOutput() } if err != nil { return []pwl.Segment{} } // Remove explicit "ruby-" prefix from segment because it's superfluous segment_components := strings.Split(segment, "-") if len(segment_components) > 1 { segment = segment_components[1] } // If gemset is missing from segment, get that info from the environment segment_components = strings.Split(segment, "@") if len(segment_components) < 2 { gemset, err := checkEnvForRubyGemset() if err == nil && gemset != "" { segment = segment + "@" + gemset } } return []pwl.Segment{{ Name: "rvm", Content: p.symbols.RvmIndicator + " " + segment, Foreground: p.theme.RvmFg, Background: p.theme.RvmBg, }} } powerline-go-1.25/segment-shellvar.go000066400000000000000000000012221463402716700176660ustar00rootroot00000000000000package main import ( "os" pwl "github.com/justjanne/powerline-go/powerline" ) func segmentShellVar(p *powerline) []pwl.Segment { shellVarName := p.cfg.ShellVar varContent, varExists := os.LookupEnv(shellVarName) if !varExists { if shellVarName != "" { warn("Shell variable " + shellVarName + " does not exist.") } return []pwl.Segment{} } if varContent == "" { if !p.cfg.ShellVarNoWarnEmpty { warn("Shell variable " + shellVarName + " is empty.") } return []pwl.Segment{} } return []pwl.Segment{{ Name: "shell-var", Content: varContent, Foreground: p.theme.ShellVarFg, Background: p.theme.ShellVarBg, }} } powerline-go-1.25/segment-shenv.go000066400000000000000000000005371463402716700172010ustar00rootroot00000000000000package main import ( "os" pwl "github.com/justjanne/powerline-go/powerline" ) func segmentShEnv(p *powerline) []pwl.Segment { env, _ := os.LookupEnv("SHENV_VERSION") if env == "" { return []pwl.Segment{} } return []pwl.Segment{{ Name: "shenv", Content: env, Foreground: p.theme.ShEnvFg, Background: p.theme.ShEnvBg, }} } powerline-go-1.25/segment-ssh.go000066400000000000000000000007701463402716700166520ustar00rootroot00000000000000package main import ( "os" pwl "github.com/justjanne/powerline-go/powerline" ) func segmentSSH(p *powerline) []pwl.Segment { sshClient, _ := os.LookupEnv("SSH_CLIENT") if sshClient == "" { return []pwl.Segment{} } var networkIcon string if p.cfg.SshAlternateIcon { networkIcon = p.symbols.NetworkAlternate } else { networkIcon = p.symbols.Network } return []pwl.Segment{{ Name: "ssh", Content: networkIcon, Foreground: p.theme.SSHFg, Background: p.theme.SSHBg, }} } powerline-go-1.25/segment-subversion.go000066400000000000000000000077061463402716700202620ustar00rootroot00000000000000package main import ( "errors" "fmt" pwl "github.com/justjanne/powerline-go/powerline" "os/exec" "strings" ) var otherModified int func addSvnRepoStatsSegment(p *powerline, nChanges int, symbol string, foreground uint8, background uint8) (segments []pwl.Segment) { if nChanges > 0 { segments = append(segments, pwl.Segment{ Name: "svn-status", Content: fmt.Sprintf("%d%s", nChanges, symbol), Foreground: foreground, Background: background, }) } return segments } func (r repoStats) SvnSegments(p *powerline) (segments []pwl.Segment) { segments = append(segments, addSvnRepoStatsSegment(p, r.ahead, p.symbols.RepoAhead, p.theme.GitAheadFg, p.theme.GitAheadBg)...) segments = append(segments, addSvnRepoStatsSegment(p, r.behind, p.symbols.RepoBehind, p.theme.GitBehindFg, p.theme.GitBehindBg)...) segments = append(segments, addSvnRepoStatsSegment(p, r.staged, p.symbols.RepoStaged, p.theme.GitStagedFg, p.theme.GitStagedBg)...) segments = append(segments, addSvnRepoStatsSegment(p, r.notStaged, p.symbols.RepoNotStaged, p.theme.GitNotStagedFg, p.theme.GitNotStagedBg)...) segments = append(segments, addSvnRepoStatsSegment(p, r.untracked, p.symbols.RepoUntracked, p.theme.GitUntrackedFg, p.theme.GitUntrackedBg)...) segments = append(segments, addSvnRepoStatsSegment(p, r.conflicted, p.symbols.RepoConflicted, p.theme.GitConflictedFg, p.theme.GitConflictedBg)...) segments = append(segments, addSvnRepoStatsSegment(p, r.stashed, p.symbols.RepoStashed, p.theme.GitStashedFg, p.theme.GitStashedBg)...) return segments } func runSvnCommand(cmd string, args ...string) (string, error) { command := exec.Command(cmd, args...) out, err := command.Output() return string(out), err } func parseSvnURL() (map[string]string, error) { info, err := runSvnCommand("svn", "info") if err != nil { return nil, errors.New("not a working copy") } svnInfo := make(map[string]string, 0) infos := strings.Split(info, "\n") if len(infos) > 1 { for _, line := range infos[:] { items := strings.Split(line, ": ") if len(items) >= 2 { svnInfo[items[0]] = items[1] } } } return svnInfo, nil } func ensureUnmodified(code string, stats repoStats) { if code != " " { otherModified++ } } func parseSvnStatus() repoStats { stats := repoStats{} info, err := runSvnCommand("svn", "status", "-u") if err != nil { return stats } infos := strings.Split(info, "\n") if len(infos) > 1 { for _, line := range infos[:] { if len(line) >= 9 { code := line[0:1] switch code { case "?": stats.untracked++ case "C": stats.conflicted++ case "A", "D", "M": stats.notStaged++ default: ensureUnmodified(code, stats) } code = line[1:2] switch code { case "C": stats.conflicted++ case "M": stats.notStaged++ default: ensureUnmodified(code, stats) } ensureUnmodified(line[2:3], stats) ensureUnmodified(line[3:4], stats) ensureUnmodified(line[4:5], stats) ensureUnmodified(line[5:6], stats) ensureUnmodified(line[6:7], stats) ensureUnmodified(line[7:8], stats) code = line[8:9] switch code { case "*": stats.behind++ default: ensureUnmodified(code, stats) } } } } return stats } func segmentSubversion(p *powerline) []pwl.Segment { svnInfo, err := parseSvnURL() if err != nil { return []pwl.Segment{} } if len(p.ignoreRepos) > 0 { if p.ignoreRepos[svnInfo["URL"]] || p.ignoreRepos[svnInfo["Relative URL"]] { return []pwl.Segment{} } } svnStats := parseSvnStatus() var foreground, background uint8 if svnStats.dirty() || otherModified > 0 { foreground = p.theme.RepoDirtyFg background = p.theme.RepoDirtyBg } else { foreground = p.theme.RepoCleanFg background = p.theme.RepoCleanBg } segments := []pwl.Segment{{ Name: "svn-branch", Content: svnInfo["Relative URL"], Foreground: foreground, Background: background, }} segments = append(segments, svnStats.SvnSegments(p)...) return segments } powerline-go-1.25/segment-termtitle.go000066400000000000000000000015761463402716700200730ustar00rootroot00000000000000package main // Port of set_term_title segment from powerine-shell: // https://github.com/b-ryan/powerline-shell/blob/master/powerline_shell/segments/set_term_title.py import ( "fmt" "os" "strings" pwl "github.com/justjanne/powerline-go/powerline" ) func segmentTermTitle(p *powerline) []pwl.Segment { var title string term := os.Getenv("TERM") if !(strings.Contains(term, "xterm") || strings.Contains(term, "rxvt")) { return []pwl.Segment{} } if p.cfg.Shell == "bash" { title = "\\[\\e]0;\\u@\\h: \\w\\a\\]" } else if p.cfg.Shell == "zsh" { title = "%{\033]0;%n@%m: %~\007%}" } else { cwd := p.cwd title = fmt.Sprintf("\033]0;%s@%s: %s\007", p.username, p.hostname, cwd) } return []pwl.Segment{{ Name: "termtitle", Content: title, Priority: MaxInteger, // do not truncate HideSeparators: true, // do not draw separators }} } powerline-go-1.25/segment-terraform_workspace.go000066400000000000000000000010731463402716700221310ustar00rootroot00000000000000package main import ( "io/ioutil" "os" pwl "github.com/justjanne/powerline-go/powerline" ) const wsFile = "./.terraform/environment" func segmentTerraformWorkspace(p *powerline) []pwl.Segment { stat, err := os.Stat(wsFile) if err != nil { return []pwl.Segment{} } if stat.IsDir() { return []pwl.Segment{} } workspace, err := ioutil.ReadFile(wsFile) if err != nil { return []pwl.Segment{} } return []pwl.Segment{{ Name: "terraform-workspace", Content: string(workspace), Foreground: p.theme.TFWsFg, Background: p.theme.TFWsBg, }} } powerline-go-1.25/segment-time.go000066400000000000000000000004771463402716700170170ustar00rootroot00000000000000package main import ( "strings" pwl "github.com/justjanne/powerline-go/powerline" "time" ) func segmentTime(p *powerline) []pwl.Segment { return []pwl.Segment{{ Name: "time", Content: time.Now().Format(strings.TrimSpace(p.cfg.Time)), Foreground: p.theme.TimeFg, Background: p.theme.TimeBg, }} } powerline-go-1.25/segment-username.go000066400000000000000000000010371463402716700176710ustar00rootroot00000000000000package main import ( pwl "github.com/justjanne/powerline-go/powerline" ) func segmentUser(p *powerline) []pwl.Segment { var userPrompt string switch p.cfg.Shell { case "bash": userPrompt = "\\u" case "zsh": userPrompt = "%n" default: userPrompt = p.username } var background uint8 if p.userIsAdmin { background = p.theme.UsernameRootBg } else { background = p.theme.UsernameBg } return []pwl.Segment{{ Name: "user", Content: userPrompt, Foreground: p.theme.UsernameFg, Background: background, }} } powerline-go-1.25/segment-vgo.go000066400000000000000000000005461463402716700166510ustar00rootroot00000000000000package main import ( "os" pwl "github.com/justjanne/powerline-go/powerline" ) func segmentVirtualGo(p *powerline) []pwl.Segment { env, _ := os.LookupEnv("VIRTUALGO") if env == "" { return []pwl.Segment{} } return []pwl.Segment{{ Name: "vgo", Content: env, Foreground: p.theme.VirtualGoFg, Background: p.theme.VirtualGoBg, }} } powerline-go-1.25/segment-vimode.go000066400000000000000000000011441463402716700173340ustar00rootroot00000000000000package main import ( pwl "github.com/justjanne/powerline-go/powerline" ) func segmentViMode(p *powerline) []pwl.Segment { mode := p.cfg.ViMode if mode == "" { warn("'--vi-mode' is not set.") return []pwl.Segment{} } switch mode { case "vicmd": return []pwl.Segment{{ Name: "vi-mode", Content: "C", Foreground: p.theme.ViModeCommandFg, Background: p.theme.ViModeCommandBg, }} default: // usually "viins" or "main" return []pwl.Segment{{ Name: "vi-mode", Content: "I", Foreground: p.theme.ViModeInsertFg, Background: p.theme.ViModeInsertBg, }} } } powerline-go-1.25/segment-virtualenv.go000066400000000000000000000026641463402716700202600ustar00rootroot00000000000000package main import ( "os" "path" "strings" "gopkg.in/ini.v1" pwl "github.com/justjanne/powerline-go/powerline" ) func segmentVirtualEnv(p *powerline) []pwl.Segment { env := os.Getenv("VIRTUAL_ENV_PROMPT") if strings.HasPrefix(env, "(") && strings.HasSuffix(env, ") ") { env = strings.TrimPrefix(env, "(") env = strings.TrimSuffix(env, ") ") } if env == "" { venv, _ := os.LookupEnv("VIRTUAL_ENV") if venv != "" { cfg, err := ini.Load(path.Join(venv, "pyvenv.cfg")) if err == nil { // python >= 3.6 the venv module will not insert a prompt // key unless the `--prompt` flag is passed to the module // or if calling with the prompt arg EnvBuilder // otherwise env evaluates to an empty string, per return // of ini.File.Section.Key if pyEnv := cfg.Section("").Key("prompt").String(); pyEnv != "" { env = pyEnv } } if env == "" { env = venv } } } if env == "" { env, _ = os.LookupEnv("CONDA_ENV_PATH") } if env == "" { env, _ = os.LookupEnv("CONDA_DEFAULT_ENV") } if env == "" { env, _ = os.LookupEnv("PYENV_VERSION") } if env == "" { return []pwl.Segment{} } envName := path.Base(env) if p.cfg.VenvNameSizeLimit > 0 && len(envName) > p.cfg.VenvNameSizeLimit { envName = p.symbols.VenvIndicator } return []pwl.Segment{{ Name: "venv", Content: escapeVariables(p, envName), Foreground: p.theme.VirtualEnvFg, Background: p.theme.VirtualEnvBg, }} } powerline-go-1.25/segment-wsl.go000066400000000000000000000011161463402716700166550ustar00rootroot00000000000000package main import ( "net/url" "os" pwl "github.com/justjanne/powerline-go/powerline" ) func segmentWSL(p *powerline) []pwl.Segment { var WSL string WSLMachineName, _ := os.LookupEnv("WSL_DISTRO_NAME") WSLHost, _ := os.LookupEnv("NAME") if WSLMachineName != "" { WSL = WSLMachineName } else if WSLHost != " " { u, err := url.Parse(WSLHost) if err == nil { WSL = u.Host } } if WSL != "" { return []pwl.Segment{{ Name: "WSL", Content: WSL, Foreground: p.theme.WSLMachineFg, Background: p.theme.WSLMachineBg, }} } return []pwl.Segment{} } powerline-go-1.25/themes.go000066400000000000000000000053461463402716700157060ustar00rootroot00000000000000package main // Symbols of the theme type SymbolTemplate struct { Lock string Network string NetworkAlternate string Separator string SeparatorThin string SeparatorReverse string SeparatorReverseThin string RepoDetached string RepoBranch string RepoAhead string RepoBehind string RepoStaged string RepoNotStaged string RepoUntracked string RepoConflicted string RepoStashed string VenvIndicator string NodeIndicator string RvmIndicator string } // Theme definitions type Theme struct { BoldForeground bool Reset uint8 DefaultFg uint8 DefaultBg uint8 UsernameFg uint8 UsernameBg uint8 UsernameRootBg uint8 HostnameFg uint8 HostnameBg uint8 // The foreground-background mapping is precomputed and stored in a map for improved performance // The old script used to brute-force this at runtime HostnameColorizedFgMap map[uint8]uint8 HomeSpecialDisplay bool HomeFg uint8 HomeBg uint8 AliasFg uint8 AliasBg uint8 PathFg uint8 PathBg uint8 CwdFg uint8 SeparatorFg uint8 ReadonlyFg uint8 ReadonlyBg uint8 SSHFg uint8 SSHBg uint8 DockerMachineFg uint8 DockerMachineBg uint8 KubeClusterFg uint8 KubeClusterBg uint8 KubeNamespaceFg uint8 KubeNamespaceBg uint8 WSLMachineFg uint8 WSLMachineBg uint8 DotEnvFg uint8 DotEnvBg uint8 AWSFg uint8 AWSBg uint8 RepoCleanFg uint8 RepoCleanBg uint8 RepoDirtyFg uint8 RepoDirtyBg uint8 JobsFg uint8 JobsBg uint8 CmdPassedFg uint8 CmdPassedBg uint8 CmdFailedFg uint8 CmdFailedBg uint8 SvnChangesFg uint8 SvnChangesBg uint8 GCPFg uint8 GCPBg uint8 GitAheadFg uint8 GitAheadBg uint8 GitBehindFg uint8 GitBehindBg uint8 GitStagedFg uint8 GitStagedBg uint8 GitNotStagedFg uint8 GitNotStagedBg uint8 GitUntrackedFg uint8 GitUntrackedBg uint8 GitConflictedFg uint8 GitConflictedBg uint8 GitStashedFg uint8 GitStashedBg uint8 GoenvFg uint8 GoenvBg uint8 VirtualEnvFg uint8 VirtualEnvBg uint8 VirtualGoFg uint8 VirtualGoBg uint8 PerlbrewFg uint8 PerlbrewBg uint8 PlEnvFg uint8 PlEnvBg uint8 TFWsFg uint8 TFWsBg uint8 TimeFg uint8 TimeBg uint8 ShellVarFg uint8 ShellVarBg uint8 ShEnvFg uint8 ShEnvBg uint8 NodeFg uint8 NodeBg uint8 NodeVersionFg uint8 NodeVersionBg uint8 RvmFg uint8 RvmBg uint8 LoadFg uint8 LoadBg uint8 LoadHighBg uint8 LoadAvgValue byte LoadThresholdBad float64 NixShellFg uint8 NixShellBg uint8 DurationFg uint8 DurationBg uint8 ViModeCommandFg uint8 ViModeCommandBg uint8 ViModeInsertFg uint8 ViModeInsertBg uint8 } powerline-go-1.25/themes/000077500000000000000000000000001463402716700153475ustar00rootroot00000000000000powerline-go-1.25/themes/default.json000066400000000000000000000127451463402716700176770ustar00rootroot00000000000000{ "BoldForeground": false, "Reset": 255, "UsernameFg": 250, "UsernameBg": 240, "UsernameRootBg": 124, "HostnameFg": 250, "HostnameBg": 238, "HomeSpecialDisplay": true, "HomeFg": 15, "HomeBg": 31, "AliasFg": 15, "AliasBg": 31, "PathFg": 250, "PathBg": 237, "CwdFg": 254, "SeparatorFg": 244, "ReadonlyFg": 254, "ReadonlyBg": 124, "SshFg": 254, "SshBg": 166, "DockerMachineFg": 177, "DockerMachineBg": 55, "WSLMachineFg": 250, "WSLMachineBg": 238, "DotEnvFg": 15, "DotEnvBg": 55, "RepoCleanFg": 0, "RepoCleanBg": 148, "RepoDirtyFg": 15, "RepoDirtyBg": 161, "JobsFg": 39, "JobsBg": 238, "CmdPassedFg": 15, "CmdPassedBg": 236, "CmdFailedFg": 15, "CmdFailedBg": 161, "SvnChangesFg": 22, "SvnChangesBg": 148, "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, "VirtualEnvFg": 0, "VirtualEnvBg": 35, "PerlbrewFg": 0, "PerlbrewBg": 20, "PlEnvFg": 0, "PlEnvBg": 32, "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, "DurationFg": 250, "DurationBg": 237, "HostnameColorizedFgMap": { "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 } powerline-go-1.25/user-is-admin.go000066400000000000000000000001511463402716700170630ustar00rootroot00000000000000// +build !windows package main import ( "os" ) func userIsAdmin() bool { return os.Getuid() == 0 } powerline-go-1.25/user-is-admin_windows.go000066400000000000000000000007411463402716700206420ustar00rootroot00000000000000// +build windows package main import ( "golang.org/x/sys/windows" ) func userIsAdmin() bool { var sid *windows.SID err := windows.AllocateAndInitializeSid( &windows.SECURITY_NT_AUTHORITY, 2, windows.SECURITY_BUILTIN_DOMAIN_RID, windows.DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &sid, ) if err != nil { return false } defer windows.FreeSid(sid) t := windows.Token(0) member, err := t.IsMember(sid) if err != nil { return false } return member }