Skip to content

Commit

Permalink
Merge pull request #40 from tamada/release/v0.7.2
Browse files Browse the repository at this point in the history
update version to 0.7.2
  • Loading branch information
tamada authored Jan 27, 2025
2 parents cd74eb5 + b1f9ca9 commit 71d67cd
Show file tree
Hide file tree
Showing 28 changed files with 461 additions and 510 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/update-version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
run: |
sed "s/^version = \".*\"/version = \"${{ steps.vars.outputs.tag }}\"/" Cargo.toml > a ; mv a Cargo.toml
sed "s/\$VERSION/${{ steps.vars.outputs.tag }}/g" templates/README.md > a ; mv a README.md
for i in $(find dockers -name Dockerfile); do
for i in Dockerfile $(find dockers -name 'Dockerfile*'); do
sed "s/ARG VERSION=.*/ARG VERSION=${{ steps.vars.outputs.tag }}/g" $i > a ; mv a $i
done
Expand Down
1 change: 0 additions & 1 deletion Dockerfile

This file was deleted.

35 changes: 35 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
FROM rust:1-alpine3.20 AS builder

RUN apk --no-cache add musl-dev

WORKDIR /app

COPY Cargo.toml .
RUN mkdir src && echo "fn main() {}" > src/main.rs \
&& cargo build --release

COPY src /app/src
COPY assets /app/assets
RUN touch src/main.rs \
&& cargo build --release \
&& strip target/release/totebag -o totebag

FROM gcr.io/distroless/static-debian12:nonroot
USER nonroot

ARG VERSION=0.7.2

LABEL org.opencontainers.image.authors="Haruaki Tamada <tamada@users.noreply.github.com>" \
org.opencontainers.image.url="https://github.com/tamada/totebag" \
org.opencontainers.image.documentation="A tool for extracting/archiving files and directories in several formats." \
org.opencontainers.image.source="https://github.com/tamada/totebag/blob/main/Dockerfile" \
org.opencontainers.image.version="${VERSION}"

WORKDIR /app

ENV HOME=/app
ENV BTMEISTER_HOME=/opt/totebag

COPY --from=builder /app/totebag /opt/totebag/totebag

ENTRYPOINT [ "/opt/totebag/totebag" ]
15 changes: 11 additions & 4 deletions Makefile.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[env]
VERSION = { script = [ "grep '^version = ' Cargo.toml | sed 's/version = \"\\(.*\\)\"/\\1/g'" ] }

[tasks.format]
install_crate = "rustfmt"
command = "cargo"
Expand All @@ -12,6 +15,12 @@ dependencies = ["format"]
command = "cargo"
args = ["llvm-cov", "--html"]

[tasks.generate-completion]
script = [
"cargo run -- --generate-completion",
"cp -r target/completions ./assets"
]

# [tasks.post-build]
# description = "Generate completion files after build"
# script = [
Expand All @@ -29,12 +38,10 @@ script = ["hugo -s site"]

[tasks.docker]
description = "Build the docker image for the current arch"
script = [
"docker build -t ghcr.io/tamada/totebag:latest -t ghcr.io/tamada/totebag:${CARGO_MAKE_WORKSPACE_PACKAGE_VERSION}."
]
command = "docker build -t ghcr.io/tamada/totebag:latest -t ghcr.io/tamada/totebag:${VERSION} ."

[tasks.docker_buildx]
description = "Build the docker image for multi-arch"
script = [
"docker buildx build --platform linux/arm64/v8,linux/amd64 --output=type=image,push=true -t ghcr.io/tamada/totebag:latest -t ghcr.io/tamada/totebag:${CARGO_MAKE_WORKSPACE_PACKAGE_VERSION} ."
"docker buildx build --platform linux/arm64/v8,linux/amd64 --output=type=image,push=true -t ghcr.io/tamada/totebag:latest -t ghcr.io/tamada/totebag:${VERSION} ."
]
4 changes: 2 additions & 2 deletions dockers/Dockerfile.bookworm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM rust:1-bookworm AS builder

ARG VERSION=0.4.6
ARG VERSION=0.7.2
ARG TARGETPLATFORM

WORKDIR /work/totebag
Expand All @@ -10,7 +10,7 @@ RUN cargo build --release

FROM debian:bookworm-slim

ARG VERSION=0.4.6
ARG VERSION=0.7.2

LABEL org.opencontainers.image.source=https://github.com/tamada/totebag \
org.opencontainers.image.version=${VERSION} \
Expand Down
4 changes: 2 additions & 2 deletions dockers/Dockerfile.bullseye
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM rust:1-bullseye AS builder

ARG VERSION=0.4.6
ARG VERSION=0.7.2
ARG TARGETPLATFORM

WORKDIR /work/totebag
Expand All @@ -10,7 +10,7 @@ RUN cargo build --release

FROM debian:bullseye-slim

ARG VERSION=0.4.6
ARG VERSION=0.7.2

LABEL org.opencontainers.image.source=https://github.com/tamada/totebag \
org.opencontainers.image.version=${VERSION} \
Expand Down
139 changes: 139 additions & 0 deletions docs/resources/slide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
---
title: "totebag -- A tool for archiving files and directories and extracting several archive formats."
author: "Haruaki Tamada"
slide: true
marp: true
theme: default
---

# totebag

## A tool for extracting/archiving files and directories in several formats

![](../assets/logo.jpeg)

Haruaki Tamada (@tamada)
https://github.com/tamada/totebag

---

# Why totebag?

- There are many archivers in the world.
- The one problem is that their usage is slightly different.
- It is bothersome to learn each tool.
- Let us create a tool to support the several archive formats.
- Today's programming languages provide widespread libraries, including archivers.
- Hence, it is moderately easy to build.

---

# Build Tool

- **Tool Name**
- totebag
- **Language**
- Rust
- **Logo creation**
- Microsoft image creator(AI)
- **Tagline**
- A tool for archiving files and directories and extracting several archive formats

---

# Supported archive formats

- Cab
- Lha/Lzh (extraction only)
- Rar (extraction only)
- 7-Zip
- Tar(tar, tar+gz, tar+xz, tar+bz2, tar+zstd)
- Zip(zip, jar, war, ear)

---

# Usage

```sh
A tool for extracting/archiving files and directories in multiple formats.

Usage: totebag [OPTIONS] [ARGUMENTS]...

Arguments:
[ARGUMENTS]... List of files or directories to be processed.
If archive mode, the archive file name can specify at the first argument.
If the frist argument was not the archive name, the default archive name `totebag.zip` is applied.


Options:
--to-archive-name-dir extract files to DEST/ARCHIVE_NAME directory (extract mode).
-C, --dir <DIR> Specify the base directory for archiving or extracting. [default: .]
-i, --ignore-types <IGNORE_TYPES> Specify the ignore type. [possible values: default, hidden, git-ignore, git-global, git-exclude, ignore]
-n, --no-recursive No recursive directory (archive mode).
-l, --long List entries in the archive file with long format.
--level <LEVEL> Specify the log level [default: warn] [possible values: error, warn, info, debug]
-m, --mode <MODE> Mode of operation. [default: auto] [possible values: auto, archive, extract, list]
-o, --output <DEST> Output file in archive mode, or output directory in extraction mode
--overwrite Overwrite existing files.
-h, --help Print help
-V, --version Print version
```
---
# How to understand mode
The default mode is `auto`.
In `auto` mode, `totebag` decides the concrete process routine from the given arguments.
- **Extract**
- If the `mode` is `auto` and the given arguments are all archive files, `totebag` works as an `extract` mode.
- **List**
- If the `mode` is `list`, `totebag` lists the entries of the archive file given from the arguments.
- **Archive**
- If the `mode` is `auto` and the given arguments contains non-archive files, `totebag` works as an `archive` mode.
---
# Miscellaneous impression about Rust
- :-1: It is very hard to compile.
- However, the compiled program rarely causes memory-related runtime errors.
- The difficulty of compilation will be relieved by the experiences of the programmer.
- The rust requires a lot of effort to get started with the projects.
---
# Cargo
- :+1: Language standard!
- :+1: Package manager!
- :+1: Various extensions are available.
- :-1: Preparation is required to install the extensions.
- Impatient (one of the three virtues of a programmer) is not satisfied.
- We must enter the preparation command repeatedly when introducing a new extension in each environment.
- The behavior depends on the environment.
- :-1: Cannot execute external commands.
---
# What is I learn from the Rust project?
- Rust
- I have become able to program to as much extent as I want.
- When I studied two years ago, I had a lot of trouble and often couldn't do what I wanted.
- Marp
- I don't want to rely on PowerPoint to make presentation materials.
- I want to make slides in text format.
- I manage almost all of my work, such as class materials, papers, and programs on GitHub.
- The layout doesn't turn out as I want it to...
- I can't edit the pptx afterwards...
---
# Summary
- I created a tool `totebag` that handles multiple compression formats.
- I created it in Rust.
- It was a good opportunity to learn Rust.
- I'm not sure if I will continue to use Marp...
File renamed without changes.
Loading

0 comments on commit 71d67cd

Please sign in to comment.