Compare commits
	
		
			4 Commits
		
	
	
		
			72bef1ea47
			...
			21faadcfc7
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 21faadcfc7 | |||
| d744ebf9f2 | |||
| 13897bf625 | |||
| 13767d8c0c | 
@@ -1,9 +1,7 @@
 | 
				
			|||||||
name: CI
 | 
					name: Docs
 | 
				
			||||||
on:
 | 
					on:
 | 
				
			||||||
  push:
 | 
					  push:
 | 
				
			||||||
    branches: [ "master" ]
 | 
					    branches: [ "master" ]
 | 
				
			||||||
  pull_request:
 | 
					 | 
				
			||||||
    branches: [ "master" ]
 | 
					 | 
				
			||||||
  workflow_dispatch:
 | 
					  workflow_dispatch:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
jobs:
 | 
					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
 | 
				
			||||||
DOC_DIR ?= doc
 | 
					 | 
				
			||||||
TESTS_DIR ?= .
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
all: test
 | 
					all: test
 | 
				
			||||||
 | 
					
 | 
				
			||||||
test:
 | 
					test:
 | 
				
			||||||
	v test $(TESTS_DIR)
 | 
						v test .
 | 
				
			||||||
 | 
					
 | 
				
			||||||
doc:
 | 
					doc:
 | 
				
			||||||
	v doc -f html -m ./$(SRC_DIR) -o $(DOC_DIR)
 | 
						v doc -f html -m . -o $(DOC_DIR)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
serve: clean doc
 | 
					serve: clean doc
 | 
				
			||||||
	v -e "import net.http.file; file.serve(folder: '$(DOC_DIR)')"
 | 
						v -e "import net.http.file; file.serve(folder: '$(DOC_DIR)')"
 | 
				
			||||||
@@ -16,8 +14,8 @@ serve: clean doc
 | 
				
			|||||||
build:
 | 
					build:
 | 
				
			||||||
	v -path "$$(realpath $$PWD/../)|@vlib|@vmodules" \
 | 
						v -path "$$(realpath $$PWD/../)|@vlib|@vmodules" \
 | 
				
			||||||
		-prod -parallel-cc -cflags -static -cflags -s -d no_segfault_handler \
 | 
							-prod -parallel-cc -cflags -static -cflags -s -d no_segfault_handler \
 | 
				
			||||||
		cmd/dataunit -o dataunit
 | 
							cmd/datasize -o datasize
 | 
				
			||||||
 | 
					
 | 
				
			||||||
clean:
 | 
					clean:
 | 
				
			||||||
	rm -r $(DOC_DIR) || true
 | 
						rm -r $(DOC_DIR) >/dev/null 2>&1 || true
 | 
				
			||||||
	rm dataunit || true
 | 
						rm datasize >/dev/null 2>&1|| true
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -23,17 +23,12 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// For more information, please refer to <https://unlicense.org/>
 | 
					// For more information, please refer to <https://unlicense.org/>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
	dataunit - a simple CLI tool for data units convertion.
 | 
					 | 
				
			||||||
*/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
module main
 | 
					module main
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import os
 | 
					import os
 | 
				
			||||||
import flag
 | 
					import flag
 | 
				
			||||||
import dataunits
 | 
					import dataunits
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@[name: 'dataunit']
 | 
					 | 
				
			||||||
struct FlagConfig {
 | 
					struct FlagConfig {
 | 
				
			||||||
	help bool
 | 
						help bool
 | 
				
			||||||
	from string @[short: f]
 | 
						from string @[short: f]
 | 
				
			||||||
@@ -55,7 +50,7 @@ fn main() {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	if flags.help {
 | 
						if flags.help {
 | 
				
			||||||
		println('convert the value between data size units.')
 | 
							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('options:')
 | 
				
			||||||
		println('  -help      print this help message and exit')
 | 
							println('  -help      print this help message and exit')
 | 
				
			||||||
		println('  -f, -from  source data unit')
 | 
							println('  -f, -from  source data unit')
 | 
				
			||||||
		Reference in New Issue
	
	Block a user