Skip to main content

POWERLINE SWISSARMYKNIFE

A Powerline segment. This segment shows the execution of complex command line defined by user.

By Miguel de Dios Matias.

Installation

Using pip

pip install powerline-swissarmyknife

Configuration

You can activate the Powerline Slotmachine segment by adding it to your segment configuration, for example in .config/powerline/themes/shell/default.json:

{
    "function": "powerline_swissarmyknife.execute",
    "priority": 30,
    "args": {
        "commandLine": "ps aux --no-headers | wc -l",
        "postContent": "⚙️"
    }
},

Show the number of processes running in your system.

screenshot number processes

Arguments

  • commandLine (string): The command line to execute, it can be complex (with pipes) (remember python3 runs as /bin/sh, not bash).
  • line (string): The string to format the content of segment.
    • Default: "{preContent}{output}{err}{postContent}"
  • preContent (string): The string to show before the result.
    • Default: ""
  • postContent (string): The string to show after the result.
    • Default: "🤖"
  • successCodes (list(int) or None): The values are success code return (normally 0), the background change to critical success.
    • Default: None
  • failureCodes (list(int) or None): The values are fail code return, the background change to critical failture.
    • Default: None

Examples

Shows the upload and download rate and count of torrents download in Deluge.

{
    "function": "powerline_swissarmyknife.execute",
    "priority": 30,
    "args": {
        "commandLine": "deluge-console status | awk '/Total upload:/{print $3$4} /Total download:/{print $3$4} /Downloading:/{print $2\"D\"}' | tr '\n' ' '",
        "postContent": "️"
    }
},

screenshot deluge

Show a random pornstar from redtube api.

{
    "function": "powerline_swissarmyknife.execute",
    "priority": 30,
    "args": {
        "commandLine": "if [ -f /tmp/list.redtube.json ]; then list=$(cat /tmp/list.redtube.json); else list=$(curl 'https://api.redtube.com/?data=redtube.Stars.getStarList&output=json'); echo $list > /tmp/list.redtube.json; fi; list_length=$(echo $list | jq '.stars | length'); rand=$(echo 'ibase=16;' $(openssl rand -hex 4 | tr '[a-z]' '[A-Z]')  | bc); echo $list | jq \".stars[$(echo \\\"$rand % $list_length\\\" | bc)].star.star_name\" -r",
        "postContent": " 🎥"
    }
},

screenshot pornstar

License

Licensed under the GPL3 License.

Metadata

Release files for powerline-swissarmyknife 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for powerline-swissarmyknife 1.0.0
File Size Uploaded Provenance Actions
powerline_swissarmyknife-1.0.0.tar.gz 3.5 kB Without provenance Details for powerline_swissarmyknife-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for powerline-swissarmyknife 1.0.0
File Interpreter ABI Platform Actions
powerline_swissarmyknife-1.0.0-py2-none-any.whl Python 2 none any Details for powerline_swissarmyknife-1.0.0-py2-none-any.whl

Total release size: 20.3 kB

Release files / powerline_swissarmyknife-1.0.0.tar.gz

Download URL powerline_swissarmyknife-1.0.0.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0dc56711bd7c5058283457075f9dd2b6d4f6c1b26ff317ea8f20d6eb550b8391
BLAKE2b-256 checksum
How to use checksums
3d6258e50220aa2f6a0e4a67d8d2e3f1e2a3582f37f79fd85c2144e977bce6ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.5rc1

Release files / powerline_swissarmyknife-1.0.0-py2-none-any.whl

Download URL powerline_swissarmyknife-1.0.0-py2-none-any.whl
Size 16.9 kB
Tags Python 2
SHA-256 checksum
How to use checksums
4d8e135111d31f44595ba823364e7db0fc68134664cb3a86424f9e2a7aecdb11
BLAKE2b-256 checksum
How to use checksums
d5579d07948c4990e36af6b28e2c243de1daa6b024303965966cf31d61eb25e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.5rc1

Security for powerline-swissarmyknife 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page