✨ Loli CLI ✨
✨ Loli is a pretty CLI that search animes passing images or links using trace.moe API ✨
Getting Started |
Versioning
➤ Getting Started
If you want contribute on this project, first you need to make a git clone:
- git clone --depth 1 https://github.com/ci-monk/loli.git -b main
This will give you access to the code on your local machine.
➤ Installation
go install github.com/ci-monk/loli/cmd/loli
# if you cannot install directly, try following command,
# then input install command again
go get -x -u github.com/ci-monk/loli/cmd/loli
Or use a binary from releases.
➤ Description
This CLI is intended to be a code lab and best practices for creating a project ready to receive community builds, while introducing the basics for creating a CLI tool in Go and the standardization of conventions for the development workflow.
➤ Learning
In this process, I gained experiences in the following topics regarding the Go language:
- ✔️ Discover internal Go packages like:
os
, string
and fmt
.
- ✔️ Discover the
github.com/spf13/cobra
CLI library.
- ✔️ Create commands and subcommands for your CLI.
- ✔️ Read flags and arguments from your commands and subcommands.
- ✔️ Discover the
github.com/spf13/viper
configuration library.
- ✔️ Read and write a configuration file.
- ✔️ Put the
snake
and the viper
to work together.
- ✔️ Read environment variables.
- ✔️ Discover the
github.com/sirupsen/logrus
log library.
- ✔️ Use variable injection at build time.
- ✔️ Use conditional in compilation and build tags.
- ✔️ How to build CLI using Go
➤ Trace.moe
Example trace.moe response:
{
"frameCount": 745506,
"error": "",
"result": [
{
"anilist": {
"id": 99939,
"idMal": 34658,
"title": { "native": "ネコぱらOVA", "romaji": "Nekopara OVA", "english": null },
"synonyms": ["Neko Para OVA"],
"isAdult": false
},
"filename": "Nekopara - OVA (BD 1280x720 x264 AAC).mp4",
"episode": null,
"from": 97.75,
"to": 98.92,
"similarity": 0.9440424588727485,
"video": "https://media.trace.moe/video/99939/Nekopara%20-%20OVA%20(BD%201280x720%20x264%20AAC).mp4?t=98.33500000000001&token=xxxxxxxxxxxxxx",
"image": "https://media.trace.moe/image/99939/Nekopara%20-%20OVA%20(BD%201280x720%20x264%20AAC).mp4?t=98.33500000000001&token=xxxxxxxxxxxxxx"
}
]
}
➤ Development with docker
Estágios para buidar a imagem Docker:
🐋 Build
Docker commands to build your image:
docker image build -t <IMAGE_NAME> -f <PATH_DOCKERFILE> <PATH_CONTEXT_DOCKERFILE>
docker image build -t <IMAGE_NAME> . (This context)
🐋 Run
Docker commands to run a container with your image:
docker container run -d -p <LOCAL_PORT:CONTAINER_PORT> <IMAGE_NAME> <COMMAND>
docker container run -it --rm --name <CONTAINER_NAME> -p <LOCAL_PORT:CONTAINER_PORT> <IMAGE_NAME> <COMMAND>
winpty docker.exe container run -it --rm <IMAGE_NAME> <COMMAND>
➤ Usage
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
Get Anime By Image File
loli file anime.jpg
Get Anime By Image Link
loli link https://anime.com/image.png
➤ Visuals
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
Get Anime By Image File
Get Anime By Image Link
➤ Links
➤ Versioning
To check the change history, please access the CHANGELOG.md file.
➤ Show your support