Updating copyrights, start method for container, updating BashOOP

This commit is contained in:
Ad5001 2022-01-07 15:30:05 +01:00
parent c44653bb42
commit 756c6689fb
Signed by: Ad5001
GPG key ID: EF45F9C6AFE20160
5 changed files with 61 additions and 4 deletions

View file

@ -1,6 +1,6 @@
#
# DockerBashOOP - Implementation of BashOOP for Docker.
# Copyright (C) 2021 Ad5001 <mail@ad5001.eu>
# Copyright (C) 2022 Ad5001 <mail@ad5001.eu>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
@ -203,6 +203,12 @@ Container.logs() {
$this.applyToAll logs $@
}
# Starts all stopped containers
# Signature: ([string[] arguments]) -> string
Container.start() {
$this.applyToAll start $@
}
# Executes a command to all the containers assigned to the instance.
# Signature: ([string[] options] <string command>) -> void|string
Container.exec() {

View file

@ -1,6 +1,6 @@
#
# DockerBashOOP - Implementation of BashOOP for Docker.
# Copyright (C) 2021 Ad5001 <mail@ad5001.eu>
# Copyright (C) 2022 Ad5001 <mail@ad5001.eu>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by

51
README.md Normal file
View file

@ -0,0 +1,51 @@
# DockerBashOOP
---
Small implementation of Docker for BashOOP.
### Documentation
You can generate the documentation using my [bash DocGenerator](https://git.ad5001.eu/Ad5001/DocGenerator).
### How to use
Import the library:
```bash
. $OOP_ROOT/oop.sh
importNamespace "path/to/Docker.shn"
```
**Note**: The guides require to know how to use [BashOOP Objects](https://git.ad5001.eu/Ad5001/BashOOP).
You can store several docker containers in a single Docker.Container object.
The way it's constructed is using keywords that acts as filter for all current Docker containers (both running and stopped).
For example:
Find all stopped containers based on the image ubuntu:14:04 :
```bash
Docker.Container c with_image "ubuntu:14.04" stopped
```
**Note**: If you're executing this as a non root user, you may be prompted for your account password in order to access docker data.
A list of all filters can be found in the documentation.
You can see if any object was found using `$c.found`, and the count of containers found using `$c.count`.
You can then access their properties like you would any other object:
```bash
# Their container name
$c.name
# Their container id
$c.id
# Their base image
$c.image
# Amongst others...
# And assign them:
names="$($c.name)"
```
**Note**: When several containers are matched, the value for each container will be put on a new line.

View file

@ -1,6 +1,6 @@
#
# DockerBashOOP - Implementation of BashOOP for Docker.
# Copyright (C) 2021 Ad5001 <mail@ad5001.eu>
# Copyright (C) 2022 Ad5001 <mail@ad5001.eu>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by

@ -1 +1 @@
Subproject commit 7663b31788a1c03ebec380a3b71652bd29c05de3
Subproject commit 82038ce35d4c695bcd627f461479e219277c2c84