diff --git a/www/data/images/program_img/dops.png b/www/data/images/program_img/dops.png new file mode 100644 index 0000000..a8bee6e Binary files /dev/null and b/www/data/images/program_img/dops.png differ diff --git a/www/extern/egg/Logger.php b/www/extern/egg/Logger.php index 2b21b92..47f3127 100644 --- a/www/extern/egg/Logger.php +++ b/www/extern/egg/Logger.php @@ -53,7 +53,7 @@ class SingleFileLogger implements ILogger public function __construct($filename) { $this->path = $filename; - file_put_contents($this->path, '', FILE_TEXT); + file_put_contents($this->path, ''); } public function proclog($text) diff --git a/www/internals/modules/programs.php b/www/internals/modules/programs.php index 4095290..f28d707 100644 --- a/www/internals/modules/programs.php +++ b/www/internals/modules/programs.php @@ -2,7 +2,7 @@ class Programs implements IWebsiteModule { - const PROG_LANGS = [ 'Java', 'C#', 'Delphi', 'PHP', 'C++', 'Rust', 'Typescript' ]; + const PROG_LANGS = [ 'Java', 'C#', 'Delphi', 'PHP', 'C++', 'Rust', 'Typescript', 'Go' ]; const URL_ORDER = [ diff --git a/www/internals/ruleengine.php b/www/internals/ruleengine.php index b209d1f..bd8da6e 100644 --- a/www/internals/ruleengine.php +++ b/www/internals/ruleengine.php @@ -19,7 +19,7 @@ class RuleEngine $parse = parse_url($requri); $path = isset($parse['path']) ? $parse['path'] : ''; - $pathparts = preg_split('@/@', $path, NULL, PREG_SPLIT_NO_EMPTY); + $pathparts = preg_split('@/@', $path, -1, PREG_SPLIT_NO_EMPTY); $partcount = count($pathparts); foreach ($urlConfig as $rule) diff --git a/www/statics/programs/__all.php b/www/statics/programs/__all.php index 7c7491a..2f6ae06 100644 --- a/www/statics/programs/__all.php +++ b/www/statics/programs/__all.php @@ -733,4 +733,23 @@ return 'download' => 'https://github.com/Mikescher/CanvasCellSim', ], ], + + + [ + 'name' => './dops - better docker ps', + 'internal_name' => 'dops', + 'internal_name_alt' => null, + 'category' => 'Commandline', + 'stars' => 3, + 'ui_language' => 'English', + 'prog_language' => 'Go', + 'short_description' => 'A replacement for the default docker-ps that tries to fit into the width of the terminal.', + 'add_date' => '2922-10-15', + 'license' => 'MIT', + 'urls' => + [ + 'github' => 'https://github.com/Mikescher/better-docker-ps', + 'download' => 'https://github.com/Mikescher/better-docker-ps/releases', + ], + ], ]; \ No newline at end of file diff --git a/www/statics/programs/dops_description.md b/www/statics/programs/dops_description.md new file mode 100644 index 0000000..736e74a --- /dev/null +++ b/www/statics/programs/dops_description.md @@ -0,0 +1,142 @@ +# ./dops - better `docker ps` +A replacement for the default docker-ps that tries really hard to fit into the width of your terminal. + +![](https://raw.githubusercontent.com/Mikescher/better-docker-ps/master/readme.d/main.png) + +## Rationale + +By default, my `docker ps` output is really wide and every line wraps around into three. +This (obviously) breaks the tabular display and makes everything chaotic. +*(This is becomes really extreme if one container has multiple port mappings, and they are all displayed in a single row)* +It does not look like we will get a better output in the foreseeable future (see [moby#7477](https://github.com/moby/moby/issues/7477)), so I decided to make my own drop-in replacement. + +## Features + +- All normal commandline flags/options from docker-ps work *(almost)* the same. +- Write multi-value data (like multiple port mappings, multiple networks, etc.) into multiple lines instead of concatenating them. +- Add color to the STATE and STATUS column (green / yellow / red). +- Automatically remove columns in the output until it fits in the current terminal width. + + +More Changes from default docker-ps: +- Show (by default) the container-cmd without arguments. +- Show the ImageName (by default) without the registry prefix, and split ImageName and ImageTag into two columns. +- Added the columns IP and NETWORK to the default column set (if they fit) +- Added support for a few new columns (via --format): + `{{.ImageName}`, `{{.ImageTag}`, `{{.Tag}`, `{{.ImageRegistry}`, `{{.Registry}`, `{{.ShortCommand}`, `{{.LabelKeys}`, `{{.IP}` +- Added options to control the color-output, the used socket, the time-zone and time-format, etc (see `./dops --help`) + +## Getting started + +- Download the latest binary from the [releases page](https://github.com/Mikescher/better-docker-ps/releases) +- but it into yout PATH (eg /usr/local/bin) +- (optional) alias the docker ps command (see [section below](#usage-as-drop-in-replacement)) + +## Screenshots + +![](https://raw.githubusercontent.com/Mikescher/better-docker-ps/master/readme.d/fullsize.png) +All (default) columns visible + +  + +![](https://raw.githubusercontent.com/Mikescher/better-docker-ps/master/readme.d/default.png) +Output on a medium sized terminal + +  + +![](https://raw.githubusercontent.com/Mikescher/better-docker-ps/master/readme.d/small.png) +Output on a small terminal + +  + +## Usage as drop-in replacement + +You can fully replace docker ps by creating a shell function in your `.bashrc` / `.zshrc`... + +~~~sh +docker() { + case $1 in + ps) + shift + command dops "$@" + ;; + *) + command docker "$@";; + esac +} +~~~ + +This will alias every call to `docker ps ...` with `dops ...` (be sure to have the dops binary in your PATH). + +If you are using the fish-shell you have to create a (similar) function: + +~~~fish +function docker + if test -n "$argv[1]" + switch $argv[1] + case ps + dops $argv[2..-1] + case '*' + command docker $argv[1..-1] + end + end +end +~~~ + +## Manual + +Output of `./dops --help`: + +~~~~~~ +better-docker-ps + +Usage: + dops [OPTIONS] List docker container + +Options (default): + -h, --help Show this screen. + --version Show version. + --all , -a Show all containers (default shows just running) + --filter , -f Filter output based on conditions provided + --format Pretty-print containers using a Go template + --last , -n Show n last created containers (includes all states) + --latest , -l Show the latest created container (includes all states) + --no-trunc Don't truncate output + --quiet , -q Only display container IDs + --size , -s Display total file sizes + +Options (extra | do not exist in `docker ps`): + --silent Do not print any output + --timezone Specify the timezone for date outputs + --color Enable/Disable terminal color output + --no-color Disable terminal color output + --socket Specify the docker socket location (Default: /var/run/docker.sock) + --timeformat Specify the datetime output format (golang syntax) + --no-header Do not print the table header + --simple-header Do not print the lines under the header + --format You can specify multiple formats and the first one that fits your terminal widt will be used + +Available --format keys (default): + {{.ID}} Container ID + {{.Image}} Image ID + {{.Command}} Quoted command + {{.CreatedAt}} Time when the container was created. + {{.RunningFor}} Elapsed time since the container was started. + {{.Ports}} Exposed ports. + {{.State}} Container status + {{.Status}} Container status with details + {{.Size}} Container disk size. + {{.Names}} Container names. + {{.Labels}} All labels assigned to the container. + {{.Label}} [!] Unsupported + {{.Mounts}} Names of the volumes mounted in this container. + {{.Networks}} Names of the networks attached to this container. + +Available --format keys (extra | do not exist in `docker ps`): + {{.ImageName}} Image ID (without tag and registry) + {{.ImageTag}}, {{.Tag}} Image Tag + {{.ImageRegistry}}, {{.Registry}} Image Registry + {{.ShortCommand}} Command without arguments + {{.LabelKeys}} All labels assigned to the container (keys only) + {{.IP}} Internal IP Address +~~~~~~