Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
chermed committed Aug 15, 2021
0 parents commit f59d20b
Show file tree
Hide file tree
Showing 53 changed files with 3,996 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.git
config.yaml
*.log
.vscode/
.github/
32 changes: 32 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: new
assignees: chermed

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Environment (please complete the following information):**
- OS: [e.g. iOS]
- Terminal [e.g. iTerm 2]
- Version [e.g. 0.1.0]

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: new
assignees: chermed

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
134 changes: 134 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
name: Main

on:
push:
tags:
- "v*.*.*"
jobs:
build-docker:
runs-on: ubuntu-20.04
steps:
- name: Setup Docker
uses: docker-practice/actions-setup-docker@master
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Checkout
uses: actions/checkout@v2
- name: Build docker image
run: |
version=$(git describe --always --tags)
docker build . -t chermed/kodoo:$version -t chermed/kodoo:latest
docker push chermed/kodoo:$version
docker push chermed/kodoo:latest
build-linux:
runs-on: ubuntu-20.04
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.16
- name: Setup GO env
run: go env -w CGO_ENABLED=0
- name: Checkout
uses: actions/checkout@v2
- name: Build binary
id: build-binary
run: |
version=$(git describe --always --tags)
binaryname=kodoo-$(go env GOOS)-$(go env GOARCH)-$version
echo "::set-output name=binaryname::$binaryname"
go build -o $binaryname
- name: Upload artifact
uses: "actions/upload-artifact@v2"
with:
name: linux
path: ${{ steps.build-binary.outputs.binaryname }}

build-darwin:
runs-on: macos-10.15
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.16
- name: Setup GO env
run: go env -w CGO_ENABLED=0
- name: Checkout
uses: actions/checkout@v2
- name: Build binary
id: build-binary
run: |
version=$(git describe --always --tags)
binaryname=kodoo-$(go env GOOS)-$(go env GOARCH)-$version
echo "::set-output name=binaryname::$binaryname"
go build -o $binaryname
- name: Upload artifact
uses: "actions/upload-artifact@v2"
with:
name: darwin
path: ${{ steps.build-binary.outputs.binaryname }}

build-windows:
runs-on: windows-2019
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.16
- name: Setup GO env
run: go env -w CGO_ENABLED=0
- name: Checkout
uses: actions/checkout@v2
- name: Build binary
id: build-binary
run: |
$version = git describe --always --tags
$goos = go env GOOS
$goarch = go env GOARCH
$binaryname = "kodoo-$goos-$goarch-$version.exe"
echo "::set-output name=binaryname::$binaryname"
go build -o $binaryname
- name: Upload artifact
uses: "actions/upload-artifact@v2"
with:
name: windows
path: ${{ steps.build-binary.outputs.binaryname }}

release:
runs-on: ubuntu-20.04
needs: [build-docker, build-darwin, build-windows, build-linux]
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
path: ./artifacts/
- name: Compute the version
id: compute-version
run: |
version=$(git describe --always --tags)
echo "::set-output name=version::$version"
- name: Substite the installations instructions
uses: cuchi/[email protected]
with:
template: INSTALL.md
output_file: INSTALL.md
strict: true
variables: |
version=${{ steps.compute-version.outputs.version }}
- name: Compute the changes
run: |
cat INSTALL.md >> RELEASE-CHANGES.md
echo "" >> RELEASE-CHANGES.md
cat CHANGES.md >> RELEASE-CHANGES.md
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
./artifacts/**/kodoo-*
body_path: RELEASE-CHANGES.md
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/
config.yaml
*.log
.vscode
kodoo
7 changes: 7 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Highlights:

First release

# Fixes:

First release
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM golang:1.15-alpine as builder
RUN apk --no-cache add ca-certificates git
WORKDIR /build/kodoo

COPY go.mod ./
RUN go mod download

COPY . ./
RUN CGO_ENABLED=0 go build

FROM alpine
WORKDIR /app
COPY --from=builder /build/kodoo/kodoo .
RUN chmod a+x kodoo && mkdir -p /.kodoo && chown -R 1000:1000 /.kodoo
USER 1000
ENTRYPOINT [ "./kodoo" ]
30 changes: 30 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Installation

## Linux

```
curl -Lo kodoo https://github.com/chermed/kodoo/releases/download/{{version}}/kodoo-linux-amd64-{{version}} && chmod +x kodoo && sudo mv kodoo /usr/local/bin
```

## macOS

```
curl -Lo kodoo https://github.com/chermed/kodoo/releases/download/{{version}}/kodoo-darwin-amd64-{{version}} && chmod +x kodoo && sudo mv kodoo /usr/local/bin
```

## Windows

```
https://github.com/chermed/kodoo/releases/download/{{version}}/kodoo-windows-amd64-{{version}}.exe
```

## Docker image

`chermed/kodoo:{{version}}`
```
docker run -it --rm -v $(pwd):/.kodoo --net host chermed/kodoo:{{version}} init-config
docker run -it --rm -v $(pwd):/.kodoo --net host chermed/kodoo:{{version}}
```


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) 2021 Mohamed Cherkaoui

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.
61 changes: 61 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Overview

**Terminal UI for Odoo**

This application is calling the Odoo API to scrape the data, it makes an effort to show them on terminal with the ability of the navigation, it's destined for Odoo developers and customers, the first release is tested using the version Odoo 14, the next version will be more compatible with many other versions >= 12.0.


[![asciicast](https://asciinema.org/a/430567.svg)](https://asciinema.org/a/430567)

# Installation :

Check the [release page](https://github.com/chermed/kodoo/releases)

# Get started

1. Install the binary using the instructions on the release page
2. Initialize the configuration using the command `kodoo init-config`
3. Edit the configuration (only the list of servers is mandatory)
4. Run the command `kodoo`
5. Start to query the Odoo API


# Features

1. Switch between many Odoo servers
2. Manage and run macros
3. Query objects and automatic refresh
4. Pagination support
5. Quick access to related records
6. Auto detection of fields to show as columns in the table
7. Run remote function on a selected record
8. Sort and filter records

# Use cases

1. For developers :
1. Provide a fast way to see IDs and metadata of records.
2. Query very easily the data on invisible objects and invisible fields
2. For Odoo customers :
1. Use the Zen mode to display data on a hanging screen (Kitchen for a restaurant, Work orders for the manufacturing, etc)

# Limitations :

1. Filtering data is basic:
1. The values in the domain are sent to odoo as strings or list of strings
2. If many filters are specified the logical operator is `AND`
2. Binary and reference fields value will not be shown or downloaded


## Roadmap for the the version v0.2.0

The features to be introduced are :

1. Show shortcuts for different relations
2. Call a remote function for many records (multiple selection)
3. See details of a record (show all fields values)
4. See metadata of a record
5. List and change the databases
6. Ensure compatibility with more Odoo versions
7. Add the readonly mode
8. Add the zen mode (focus on data)
30 changes: 30 additions & 0 deletions cmd/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package cmd

import (
"fmt"

"github.com/chermed/kodoo/internal/config"
"github.com/gookit/color"
"github.com/spf13/cobra"
)

var initConfigCmd = &cobra.Command{
Use: "init-config",
Short: "Create a basic configuration file if not exists",
Run: func(cmd *cobra.Command, args []string) {
path, err := config.InitConfigFiles()
if err != nil {
color.Redln(err)
} else {
color.Greenln(fmt.Sprintf("The configuration file is created to %s", path))
}
},
}

var sampleConfigCmd = &cobra.Command{
Use: "sample-config",
Short: "Show a sample configuration",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println(config.GetSampleConfig())
},
}
Loading

0 comments on commit f59d20b

Please sign in to comment.