-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upload the readme (and screenshots) and the setup.py .
- Loading branch information
Showing
7 changed files
with
149 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# POWERLINE SWISSARMYKNIFE | ||
|
||
A [Powerline](https://powerline.readthedocs.io/en/master/) segment. This segment shows the execution of complex command line defined by user. | ||
|
||
By [Miguel de Dios Matias](https://github.com/mdtrooper). | ||
|
||
## 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`: | ||
|
||
```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. | ||
|
||
 | ||
|
||
### 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. | ||
|
||
```json | ||
{ | ||
"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": "️" | ||
} | ||
}, | ||
``` | ||
|
||
|
||
 | ||
|
||
Show a random pornstar from redtube api. | ||
|
||
```json | ||
{ | ||
"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": " 🎥" | ||
} | ||
}, | ||
``` | ||
|
||
 | ||
|
||
## License | ||
|
||
Licensed under [the GPL3 License](https://github.com/mdtrooper/powerline_slotmachine/blob/master/LICENSE). |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env python3 | ||
# | ||
# slotmachine_oneline.py | ||
# Copyright (C) 2019 Miguel de Dios Matias | ||
# | ||
# 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 | ||
# 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 <http://www.gnu.org/licenses/>. | ||
|
||
from .execute import execute |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import setuptools | ||
|
||
with open("README.md", "r") as fh: | ||
long_description = fh.read() | ||
|
||
setuptools.setup( | ||
name="powerline_swissarmyknife", | ||
version="1.0.0", | ||
license="GPLv3+", | ||
author="Miguel de Dios Matias", | ||
author_email="[email protected]", | ||
description="A Powerline segment.This segment shows the execution of complex command line defined by user.", | ||
long_description=long_description, | ||
long_description_content_type="text/markdown", | ||
url="https://github.com/mdtrooper/powerline_swissarmyknife", | ||
packages=setuptools.find_packages(), | ||
classifiers=[ | ||
"Programming Language :: Python :: 3", | ||
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", | ||
"Operating System :: OS Independent", | ||
"Environment :: Console" | ||
], | ||
python_requires='>=3.7', | ||
platforms=['any'] | ||
) |