Compare commits

...

4 Commits

Author SHA1 Message Date
ge
21faadcfc7 makefile: fix 2025-04-22 20:03:50 +03:00
ge
d744ebf9f2 cmd: rename dataunit to datasize 2025-04-22 19:58:46 +03:00
ge
13897bf625 ci: add tests CI 2025-04-22 19:56:58 +03:00
ge
13767d8c0c all: stop using src/ dir 2025-04-22 19:51:49 +03:00
5 changed files with 32 additions and 17 deletions

View File

@ -1,9 +1,7 @@
name: CI
name: Docs
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
workflow_dispatch:
jobs:

24
.github/workflows/test.yaml vendored Normal file
View File

@ -0,0 +1,24 @@
name: Tests
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup V
run: |
wget -qO /tmp/v.zip https://github.com/vlang/v/releases/latest/download/v_linux.zip
unzip -q /tmp/v.zip -d /tmp
echo /tmp/v >> "$GITHUB_PATH"
- name: Run tests
run: |
v -stats test .

View File

@ -1,14 +1,12 @@
SRC_DIR ?= src
DOC_DIR ?= doc
TESTS_DIR ?= .
DOC_DIR = doc
all: test
test:
v test $(TESTS_DIR)
v test .
doc:
v doc -f html -m ./$(SRC_DIR) -o $(DOC_DIR)
v doc -f html -m . -o $(DOC_DIR)
serve: clean doc
v -e "import net.http.file; file.serve(folder: '$(DOC_DIR)')"
@ -16,8 +14,8 @@ serve: clean doc
build:
v -path "$$(realpath $$PWD/../)|@vlib|@vmodules" \
-prod -parallel-cc -cflags -static -cflags -s -d no_segfault_handler \
cmd/dataunit -o dataunit
cmd/datasize -o datasize
clean:
rm -r $(DOC_DIR) || true
rm dataunit || true
rm -r $(DOC_DIR) >/dev/null 2>&1 || true
rm datasize >/dev/null 2>&1|| true

View File

@ -23,17 +23,12 @@
// For more information, please refer to <https://unlicense.org/>
/*
dataunit - a simple CLI tool for data units convertion.
*/
module main
import os
import flag
import dataunits
@[name: 'dataunit']
struct FlagConfig {
help bool
from string @[short: f]
@ -55,7 +50,7 @@ fn main() {
}
if flags.help {
println('convert the value between data size units.')
println('usage: dataunit -f <unit> -t <unit> <value>')
println('usage: datasize -f <unit> -t <unit> <value>')
println('options:')
println(' -help print this help message and exit')
println(' -f, -from source data unit')