Skip to content

Commit c2301f2

Browse files
Merge pull request #13 from CosmicPredator/develop
Version 1.0.4
2 parents 622370c + 6dc4220 commit c2301f2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1944
-1121
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
name: Build (Multiple Arch)
22

33
on:
4-
push:
5-
branches: [ develop ]
64
pull_request:
75
branches: [ develop ]
86
workflow_dispatch:

.github/workflows/create_release.yml

Lines changed: 109 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ name: Release (Multiple Arch)
22

33
on:
44
push:
5-
branches: [ prod ]
6-
pull_request:
7-
branches: [ prod ]
5+
tags:
6+
- "*"
87
workflow_dispatch:
98

109
jobs:
1110
build_release:
11+
name: Run Make Build
1212
permissions: write-all
1313
runs-on: ubuntu-latest
1414
steps:
@@ -17,6 +17,16 @@ jobs:
1717
with:
1818
fetch-depth: 0
1919

20+
- name: Cache Go Modules
21+
uses: actions/cache@v4
22+
with:
23+
path: |
24+
~/go/pkg/mod
25+
~/.cache/go-build
26+
key: go-mod-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
27+
restore-keys: |
28+
go-mod-${{ runner.os }}-
29+
2030
- name: Run Make
2131
run: make BUILD_TYPE=RELEASE
2232

@@ -32,13 +42,22 @@ jobs:
3242
build_win_installer:
3343
needs: build_release
3444
runs-on: windows-latest
45+
name: Build Windows Installer (INNO)
3546
permissions: write-all
3647
steps:
3748
- name: Checkout
3849
uses: actions/checkout@v4
3950
with:
4051
fetch-depth: 0
4152

53+
- name: Read Version
54+
id: read_version
55+
shell: pwsh
56+
run: |
57+
$TAG = git describe --tags --abbrev=0
58+
echo "Current tag: $TAG"
59+
echo "V_TAG=$TAG" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
60+
4261
- name: Download Artifact
4362
uses: actions/download-artifact@v4
4463
with:
@@ -48,17 +67,23 @@ jobs:
4867

4968
- name: Rename Binary
5069
shell: cmd
51-
run: ren build\chibi_windows.exe chibi.exe
70+
run: ren build\chibi_${{ env.V_TAG }}_win_amd64.exe chibi.exe
5271

5372
- name: Pack Installer
5473
uses: Minionguyjpro/[email protected]
74+
env:
75+
V_TAG: ${{ env.V_TAG }}
5576
with:
5677
path: installer_scripts\chibi_setup.iss
5778
options: /O+
5879

5980
- name: Move installer to build dir
6081
shell: cmd
61-
run: move installer_scripts\Output\chibi_installer.exe build\
82+
run: move installer_scripts\Output\chibi_${{ env.V_TAG }}_installer.exe build\
83+
84+
- name: Rename Binary (Again)
85+
shell: cmd
86+
run: ren build\chibi.exe chibi_${{ env.V_TAG }}_win_amd64.exe
6287

6388
- name: Upload Installer Artifacts
6489
uses: actions/upload-artifact@v4
@@ -67,6 +92,7 @@ jobs:
6792
path: build
6893

6994
create_release:
95+
name: Publish new Release
7096
needs: build_win_installer
7197
permissions: write-all
7298
runs-on: ubuntu-latest
@@ -111,4 +137,81 @@ jobs:
111137
with:
112138
repo-token: ${{ secrets.GITHUB_TOKEN }}
113139
release-tag: ${{ env.tag }}
114-
files: "build/*"
140+
files: "build/*"
141+
142+
publish_to_winget:
143+
needs: create_release
144+
permissions: write-all
145+
runs-on: windows-latest
146+
name: Publish installer to WinGet
147+
steps:
148+
- name: Checkout
149+
uses: actions/checkout@v4
150+
with:
151+
fetch-depth: 0
152+
153+
- name: Publish to WinGet
154+
uses: vedantmgoyal9/winget-releaser@main
155+
with:
156+
identifier: CosmicPredator.Chibi
157+
installers-regex: '.*_installer\.exe$'
158+
token: ${{ secrets.WINGET_TOKEN }}
159+
160+
publish_to_snap_store:
161+
needs: create_release
162+
runs-on: ubuntu-latest
163+
name: Publish to Snap Store
164+
steps:
165+
- name: Checkout
166+
uses: actions/checkout@v4
167+
with:
168+
fetch-depth: 0
169+
170+
- name: Read Tag
171+
id: read_version
172+
run: |
173+
TAG=$(git describe --tags --abbrev=0)
174+
echo "Current tag: $TAG"
175+
echo "tag=$TAG" >> $GITHUB_ENV
176+
177+
- name: Download Artifact
178+
uses: actions/download-artifact@v4
179+
with:
180+
name: build_artifacts_with_installer
181+
github-token: ${{ secrets.GITHUB_TOKEN }}
182+
path: build/
183+
184+
- name: Rename Linux Binary
185+
run: |
186+
mv build/chibi_${{ env.tag }}_linux_amd64 build/chibi
187+
sudo chmod 777 build/chibi
188+
echo "Rename binary successful"
189+
190+
- name: Move snapcraft.yaml file to root
191+
run: |
192+
mv installer_scripts/snapcraft.yaml snapcraft.yaml
193+
echo "version: ${{ env.tag }}" >> snapcraft.yaml
194+
195+
- name: Install Snapcraft
196+
run: |
197+
sudo snap install snapcraft --classic
198+
199+
- name: Setup LXD
200+
uses: canonical/setup-lxd@main
201+
with:
202+
group: lxd
203+
204+
- name: Build snap
205+
run: |
206+
sudo usermod -a -G lxd $USER
207+
sudo snapcraft
208+
209+
- name: Upload snap to Snap Store
210+
env:
211+
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }}
212+
run: |
213+
sudo snap install snapcraft --classic
214+
snapcraft upload *.snap --release=candidate
215+
216+
217+

CHANGELOG.md

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
### ✨ What's New
2-
- The `ls` command now shows Rewatching/Rereading Media along with Current Media. The Rewatching/Rereading media will be marked by **"(R)"** before the media title.
3-
- You can now pass incremental or decremental progress to `update` command. For example,
2+
- Chibi is now available in Snap Store for Linux users. To install chibi, run
3+
```shell
4+
sudo snap install chibi
5+
- Added Loading indicator to all API Requests.
6+
- Added `chibi logout` command to log you out from AniList.
7+
- Start Date is automatically added when `chibi add` command in invoked and `status` flag is set to `watching`.
8+
- `chibi update` command now supports 2 new flags,
9+
- `-n "<note>"` for entry notes.
10+
- `-r <score>` for entry score.
411

5-
To increment progress of a media by 2,
6-
```shell
7-
$ chibi update 8861 -p +2
8-
```
9-
10-
To decrement progress of a media by 5,
11-
```shell
12-
$ chibi update 8861 -p -5
13-
```
12+
### ✨ Other Changes
13+
- Migrated from JSON file storage to Sqlite3 storage for configurations.
14+
- Complete Architecture change for faster response.
15+
- Added Code Comments in missing areas
1416

1517
### 🐛 Bug Fixes
16-
- None for now 👽️
18+
- Fixed a bad `if` check when handling start date. (085fff237d04fde01e6b19d96078af2030ab1bbb)
19+
- Fixed app exiting with weird error messages.
20+
- Fixed "WinGet not detecting app version". This change will take effect when installing upcoming versions of chibi.
21+
22+
Thanks @mist8kengas for the contributions ☺️.

Makefile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ else
1313
LDFLAGS:="-X 'main.VERSION=${LATEST_TAG}'"
1414
endif
1515

16-
LINUX_BIN=${BINARY_NAME}_linux_amd64
17-
WIN_BIN=${BINARY_NAME}_windows.exe
18-
APPLE_INTEL_BIN=${BINARY_NAME}_darwin_amd64
19-
APPLE_SILICON_BIN=${BINARY_NAME}_darwin_arm64
16+
LINUX_BIN=${BINARY_NAME}_${LATEST_TAG}_linux_amd64
17+
WIN_BIN=${BINARY_NAME}_${LATEST_TAG}_win_amd64.exe
18+
WIN_ARM_BIN=${BINARY_NAME}_${LATEST_TAG}_win_arm64.exe
19+
APPLE_INTEL_BIN=${BINARY_NAME}_${LATEST_TAG}_darwin_amd64
20+
APPLE_SILICON_BIN=${BINARY_NAME}_${LATEST_TAG}_darwin_arm64
2021

2122
.PHONY: all
2223

@@ -31,6 +32,7 @@ compile:
3132
GOARCH=amd64 GOOS=darwin go build -ldflags=${LDFLAGS} -o ${BUILD_DIR}/${APPLE_INTEL_BIN}
3233
GOARCH=arm64 GOOS=darwin go build -ldflags=${LDFLAGS} -o ${BUILD_DIR}/${APPLE_SILICON_BIN}
3334
GOARCH=amd64 GOOS=windows go build -ldflags=${LDFLAGS} -o ${BUILD_DIR}/${WIN_BIN}
35+
GOARCH=arm64 GOOS=windows go build -ldflags=${LDFLAGS} -o ${BUILD_DIR}/${WIN_ARM_BIN}
3436
GOARCH=amd64 GOOS=linux go build -ldflags=${LDFLAGS} -o ${BUILD_DIR}/${LINUX_BIN}
3537

3638
#TODO: Implement dynamic versioning

README.md

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,27 @@
1+
<div align=center>
2+
<img width=150
3+
src=https://i.imgur.com/qQ6Qs0v.png/>
4+
</div>
5+
16
<div align="center">
27
<h1>Chibi for AniList</h1>
38
<h2>A lightweight anime & manga tracker CLI app powered by AniList</h2>
49

10+
<div align="center">
11+
<a href="https://snapcraft.io/chibi">
12+
<img alt="Get it from the Snap Store" src=https://snapcraft.io/en/dark/install.svg />
13+
</a>
14+
<a href="#windows-via-winget">
15+
<img alt="Install for windows via winget" src=https://i.imgur.com/ENKa9Lv.png/>
16+
</a>
17+
</div>
18+
519
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
620
![Go](https://img.shields.io/badge/go-%2300ADD8.svg?style=flat&logo=go&logoColor=white)
721
[![Build (Multiple Arch)](https://github.com/CosmicPredator/chibi-cli/actions/workflows/build.yml/badge.svg)](https://github.com/CosmicPredator/chibi-cli/actions/workflows/build.yml)
22+
[![Release (Multiple Arch)](https://github.com/CosmicPredator/chibi-cli/actions/workflows/create_release.yml/badge.svg?branch=prod)](https://github.com/CosmicPredator/chibi-cli/actions/workflows/create_release.yml)
823

9-
![Made with VHS](https://vhs.charm.sh/vhs-4o1iqUYYSVr7QIO5m9Q5nX.gif)
24+
<!-- ![Made with VHS](https://vhs.charm.sh/vhs-4o1iqUYYSVr7QIO5m9Q5nX.gif) -->
1025

1126
</div>
1227

@@ -27,6 +42,18 @@ This section provides the quickest way to get started with chibi-cli. For detail
2742
- Most modern terminals like **Windows Terminal**, **Gnome Terminal**, **Kitty** or **Alacritty** etc., should work.
2843

2944
### Quick Installation
45+
46+
#### Linux (via snap store)
47+
```bash
48+
$ sudo snap install chibi
49+
```
50+
51+
#### Windows (via winget)
52+
```pwsh
53+
PS C:\> winget install CosmicPredator.Chibi
54+
```
55+
56+
#### Manual Installation
3057
- Download the binary for your OS from the [releases](https://github.com/CosmicPredator/chibi-cli/releases) page.
3158

3259
- Open your favourite terminal in the directory where you downloaded chibi.
@@ -57,4 +84,4 @@ This project is not possible without the following libraries,
5784
- AniList - [Website](https://anilist.co)
5885
- spf13/cobra - [GitHub](https://github.com/spf13/cobra)
5986
- charmbracelet/huh - [GitHub](https://github.com/charmbracelet/huh)
60-
- charmbracelet/lipgloss - [GitHub](https://github.com/charmbracelet/lipgloss)
87+
- charmbracelet/lipgloss - [GitHub](https://github.com/charmbracelet/lipgloss)

cmd/cmd_add.go

Lines changed: 20 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,43 @@
11
package cmd
22

33
import (
4+
"errors"
45
"fmt"
56
"os"
67
"strconv"
7-
"time"
88

9-
"github.com/CosmicPredator/chibi/internal"
9+
"github.com/CosmicPredator/chibi/internal/ui"
10+
"github.com/CosmicPredator/chibi/internal/viewmodel"
1011
"github.com/spf13/cobra"
1112
)
1213

1314
var mediaAddStatus string
1415

15-
func handleMediaAdd(mediaId int) {
16-
CheckIfTokenExists()
17-
18-
switch mediaAddStatus {
19-
case "watching", "reading", "w", "r":
20-
mediaAddStatus = "CURRENT"
21-
case "planning", "p":
22-
mediaAddStatus = "PLANNING"
23-
case "completed", "c":
24-
mediaAddStatus = "COMPLETED"
25-
case "dropped", "d":
26-
mediaAddStatus = "DROPPED"
27-
case "paused", "ps":
28-
mediaAddStatus = "PAUSED"
29-
case "repeating", "rp":
30-
mediaAddStatus = "REPEATING"
31-
default:
32-
mediaAddStatus = "CURRENT"
33-
}
34-
35-
mediaUpdate := internal.NewMediaUpdate()
36-
if mediaAddStatus == "CURRENT" {
37-
currDate := fmt.Sprintf("%d/%d/%d", time.Now().Day(), time.Now().Month(), time.Now().Year())
38-
err := mediaUpdate.Get(true, mediaId, "0", mediaAddStatus, currDate)
39-
if err != nil {
40-
ErrorMessage(err.Error())
41-
}
42-
} else {
43-
err := mediaUpdate.Get(true, mediaId, "0", mediaAddStatus, "")
44-
if err != nil {
45-
ErrorMessage(err.Error())
46-
}
16+
func handleMediaAdd(cmd *cobra.Command, args []string) {
17+
mediaId, err := strconv.Atoi(args[0])
18+
if err != nil {
19+
fmt.Println(
20+
ui.ErrorText(errors.New("invalid media ID. Please provide a valid one")),
21+
)
22+
os.Exit(0)
4723
}
48-
49-
fmt.Println(
50-
SUCCESS_MESSAGE_TEMPLATE.Render("Done ✅"),
24+
err = viewmodel.HandleMediaUpdate(
25+
viewmodel.MediaUpdateParams{
26+
IsNewAddition: true,
27+
MediaId: mediaId,
28+
Status: mediaAddStatus,
29+
},
5130
)
31+
if err != nil {
32+
fmt.Println(ui.ErrorText(err))
33+
}
5234
}
5335

5436
var mediaAddCmd = &cobra.Command{
5537
Use: "add [id]",
5638
Short: "Add a media to your list",
5739
Args: cobra.ExactArgs(1),
58-
Run: func(cmd *cobra.Command, args []string) {
59-
mediaId, err := strconv.Atoi(args[0])
60-
if err != nil {
61-
fmt.Println(ERROR_MESSAGE_TEMPLATE.Render(
62-
"Invalid media ID. Please provide a valid one",
63-
))
64-
os.Exit(0)
65-
}
66-
handleMediaAdd(mediaId)
67-
},
40+
Run: handleMediaAdd,
6841
}
6942

7043
func init() {

0 commit comments

Comments
 (0)