Skip to content

Commit

Permalink
rework 2024
Browse files Browse the repository at this point in the history
  • Loading branch information
somnek committed Jan 13, 2024
1 parent f45e244 commit affc4d5
Show file tree
Hide file tree
Showing 11 changed files with 611 additions and 556 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
debug.log
.env
.vscode
trash.md
Expand Down
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Som Nek

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
20 changes: 1 addition & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# killer-whale 🐳

Killer Whale is a Docker TUI for terminal dwellers. It provides an intuitive, easy-to-use interface for managing your Docker containers without leaving the comfort of your command line.
- more feature coming soon, thought its temping to add more feature, killer-whale meant to be as minimalistic as possible, if you are looking for docker tui with more features, check out [lazydocker](https://github.com/jesseduffield/lazydocker) by jesseduffield.



Expand Down Expand Up @@ -41,22 +42,3 @@ bash:
exec bash
```

4. Run the application:

```bash
killer-whale
```

# Features
- [x] List all containers
- [x] Start/Stop containers
- [x] Restart containers
- [x] Remove containers
- [x] List all images

# WIP 🛠️
- [ ] docker logs -> full screen
- [ ] Remove images
- [ ] Hotkeys configuration

So why settle for a boring GUI when you can have a killer 🤘 command-line interface to manage your Docker containers? Killer Whale is designed to be fun and easy to use, with intuitive keyboard shortcuts ⌨️ and an attractive, streamlined interface that won't slow you down. With Killer Whale, you'll feel like a Docker pro in no time 🚀. Give it a try and see how killer your container management skills can be! 😎
File renamed without changes.
56 changes: 56 additions & 0 deletions helper.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package main

import (
"fmt"
"log"

docker "github.com/fsouza/go-dockerclient"
)

func getContainers() []container {
client, err := docker.NewClientFromEnv()
if err != nil {
log.Fatal(err)
}
containers := []container{}
for _, c := range listContainers(client, true) {
name := c.Names[0][1:]
status := c.State
c := container{name: name, state: status, id: c.ID, ancestor: c.Image}
containers = append(containers, c)
}
return containers
}

func getImages() []image {
client, err := docker.NewClientFromEnv()
if err != nil {
log.Fatal(err)
}
images := []image{}
for _, c := range listImages(client, true) {
tags := c.RepoTags
var name string
var size int64
if len(tags) > 0 {
name = tags[0]
size = c.Size
// format size (GB, MB, KB)
if size > 1000000000 {
size = size / 1000000000
name = fmt.Sprintf("%s (%dGB)", name, size)
} else if size > 1000000 {
size = size / 1000000
name = fmt.Sprintf("%s (%dMB)", name, size)
} else if size > 1000 {
size = size / 1000
name = fmt.Sprintf("%s (%dKB)", name, size)
} else {
name = fmt.Sprintf("%s (%dB)", name, size)
}
c := image{name: name, id: c.ID}
images = append(images, c)
}
}
return images
}
Loading

0 comments on commit affc4d5

Please sign in to comment.