Compare commits
4 Commits
72bef1ea47
...
21faadcfc7
Author | SHA1 | Date | |
---|---|---|---|
21faadcfc7 | |||
d744ebf9f2 | |||
13897bf625 | |||
13767d8c0c |
@ -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
24
.github/workflows/test.yaml
vendored
Normal 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 .
|
14
Makefile
14
Makefile
@ -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
|
||||
|
@ -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')
|
Reference in New Issue
Block a user