🍾 Initial commit
This commit is contained in:
commit
58ec1de9e1
5
.cargo/config.toml
Normal file
5
.cargo/config.toml
Normal file
@ -0,0 +1,5 @@
|
||||
[registries.lugit]
|
||||
index = "sparse+http://lugit.local/api/packages/lucodear/cargo/"
|
||||
|
||||
[registry]
|
||||
global-credential-providers = ["cargo:token"]
|
||||
4
.cocorc
Normal file
4
.cocorc
Normal file
@ -0,0 +1,4 @@
|
||||
# https://github.com/lucas-labs/coco config
|
||||
|
||||
askScope: false
|
||||
useEmoji: true
|
||||
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
/target
|
||||
.data/*.log
|
||||
.task
|
||||
29
.vscode/launch.json
vendored
Normal file
29
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
// debug rust on windows
|
||||
{
|
||||
"name": "debug: lool",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/target/debug/lool.exe",
|
||||
"args": [
|
||||
"server",
|
||||
"--force"
|
||||
],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [
|
||||
{
|
||||
"name": "KURV_HOME",
|
||||
"value": "${workspaceFolder}"
|
||||
}
|
||||
],
|
||||
"externalConsole": true,
|
||||
"preLaunchTask": "cargo: build"
|
||||
},
|
||||
]
|
||||
}
|
||||
25
.vscode/settings.json
vendored
Normal file
25
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"files.exclude": {
|
||||
// ⚙️ config
|
||||
"Taskfile.yaml": true,
|
||||
".cocorc": true,
|
||||
".task": true,
|
||||
".cargo": true,
|
||||
// "Cargo.toml": true,
|
||||
|
||||
// 📦
|
||||
"Cargo.lock": true,
|
||||
"target": true,
|
||||
|
||||
// 📝 readmes
|
||||
"**/**/README.md": true,
|
||||
"LICENSE": true,
|
||||
|
||||
// 🗑️
|
||||
"check_size.py": true,
|
||||
"*.code-workspace": true,
|
||||
".gitignore": true,
|
||||
".vscode": true,
|
||||
".git": true,
|
||||
}
|
||||
}
|
||||
19
.vscode/tasks.json
vendored
Normal file
19
.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||
// for the documentation about the tasks.json format
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "cargo: build",
|
||||
"type": "shell",
|
||||
"command": "cargo build",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"problemMatcher": [
|
||||
"$rustc"
|
||||
]
|
||||
},
|
||||
]
|
||||
}
|
||||
25
Cargo.toml
Normal file
25
Cargo.toml
Normal file
@ -0,0 +1,25 @@
|
||||
[package]
|
||||
name = "lool"
|
||||
version = "0.0.0-alpha.0"
|
||||
edition = "2021"
|
||||
description = "🧳 » lool » lucode.ar rust common utilities"
|
||||
authors = ["Lucas Colombo <lucas@lucode.ar>"]
|
||||
|
||||
[profile.release]
|
||||
strip = true
|
||||
lto = true
|
||||
codegen-units = 16
|
||||
opt-level = 'z'
|
||||
panic = "abort"
|
||||
rpath = false
|
||||
overflow-checks = false
|
||||
debug = 0
|
||||
debug-assertions = false
|
||||
|
||||
[dependencies]
|
||||
eyre = { version = "0.6.12", default-features = false, features = ["auto-install"] }
|
||||
indoc = "2.0.4"
|
||||
|
||||
[[bin]]
|
||||
name = "lool"
|
||||
path = "src/main.rs"
|
||||
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2023 Lucas Colombo <lucas@lucode.ar>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
25
Taskfile.yaml
Normal file
25
Taskfile.yaml
Normal file
@ -0,0 +1,25 @@
|
||||
# https://taskfile.dev
|
||||
|
||||
version: '3'
|
||||
|
||||
tasks:
|
||||
run:watch:
|
||||
desc: 🚀 watch lool
|
||||
cmds:
|
||||
- cargo watch -c -x "run -- --version"
|
||||
|
||||
build:watch:
|
||||
desc: 🚀 watch lool «build»
|
||||
cmds:
|
||||
- cargo watch -c -x "build"
|
||||
|
||||
build:
|
||||
desc: ⚡ build lool «release»
|
||||
cmds:
|
||||
- cargo build --release
|
||||
- python check_size.py
|
||||
|
||||
fmt:
|
||||
desc: 🚀 format lool
|
||||
cmds:
|
||||
- cargo +nightly fmt --all
|
||||
56
check_size.py
Normal file
56
check_size.py
Normal file
@ -0,0 +1,56 @@
|
||||
"""
|
||||
small script to run after build, to check if there was a significant
|
||||
change on executable size, compared to the previous build.
|
||||
|
||||
this aims to detect unwanted big differences before it's too late
|
||||
"""
|
||||
|
||||
|
||||
import os
|
||||
import pathlib
|
||||
|
||||
curr_dir = pathlib.Path(os.getcwd())
|
||||
sizefile_path = pathlib.Path(curr_dir.joinpath('.task'))
|
||||
|
||||
|
||||
def bad(txt):
|
||||
return '\033[91m' + txt + '\033[0m'
|
||||
|
||||
|
||||
def good(txt):
|
||||
return '\033[92m' + txt + '\033[0m'
|
||||
|
||||
|
||||
def head(txt):
|
||||
return '\033[94m' + txt + '\033[0m'
|
||||
|
||||
|
||||
files = {
|
||||
'release': curr_dir.joinpath('target/release/lool.exe'),
|
||||
'debug': curr_dir.joinpath('target/debug/lool.exe'),
|
||||
}
|
||||
|
||||
print("\n🧉 » exe file sizes change\n")
|
||||
|
||||
for key, exe in files.items():
|
||||
if exe.is_file():
|
||||
sizefile = sizefile_path.joinpath(key)
|
||||
new_size: float = os.stat(exe).st_size / 1024
|
||||
old_size: float
|
||||
|
||||
try:
|
||||
with open(sizefile, 'r') as f:
|
||||
old_size = float(f.read())
|
||||
except FileNotFoundError:
|
||||
old_size = 0
|
||||
|
||||
# diff: str = f'{old_size:.0f}kb'
|
||||
diff = new_size - old_size
|
||||
diff_str = f"{'+' if diff > 0 else '=' if diff == 0 else ''}{diff:.0f}kb"
|
||||
|
||||
fmt = bad if diff > 10 else good
|
||||
|
||||
sizefile.parent.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
with open(sizefile, 'w') as f:
|
||||
f.write(f'{new_size}')
|
||||
6
rustfmt.toml
Normal file
6
rustfmt.toml
Normal file
@ -0,0 +1,6 @@
|
||||
max_width = 100
|
||||
array_width = 80
|
||||
chain_width = 100
|
||||
comment_width = 80
|
||||
imports_indent = "Block"
|
||||
imports_granularity = "One"
|
||||
7
src/main.rs
Normal file
7
src/main.rs
Normal file
@ -0,0 +1,7 @@
|
||||
use eyre::Result;
|
||||
|
||||
fn main() -> Result<()> {
|
||||
println!("Hello World");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
20
🧳 lool.code-workspace
Normal file
20
🧳 lool.code-workspace
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"folders": [
|
||||
{
|
||||
"path": "."
|
||||
}
|
||||
],
|
||||
"settings": {
|
||||
"terminal.integrated.env.windows": {
|
||||
// allows to run the command in the terminal for development purposes
|
||||
"PATH": "${workspaceFolder}/target/debug;${env:PATH}",
|
||||
},
|
||||
"lucodear-icons.activeIconPack": "rust_ferris",
|
||||
"lucodear-icons.folders.associations": {
|
||||
".cargo": "rust",
|
||||
},
|
||||
"lucodear-icons.files.associations": {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user