3个版本
0.0.3 | 2024年6月6日 |
---|---|
0.0.2 | 2024年6月5日 |
0.0.1 | 2024年6月4日 |
在日期和时间类别中排名第133
每月下载量74次
67KB
1K SLoC
Tracktorial
从命令行打卡、签退和休息。也可以一次性为当前预订期预订班次。
用法
可以从终端执行可执行文件来运行Tracktorial。
tracktorial <COMMAND> [OPTIONS]
Commands:
shift-start Start a new shift
-n, --now Start shift now
-t, --time <TIME> Start shift at the specified time. Time should have a format of HH:MM:SS or HH:MM
-d, --duration <DURATION> Start a shift either now or at <TIME> and end it after <DURATION>or at <END>. Duration Should have a format of <hours>h<minutes>m<seconds>, <hours>h<minutes>m or <hours>h
-e, --end <END> The started shift should end at <END> (HH:MM:SS or HH:MM)
-f, --force Override existing shifts
-h, --help Print help
shift-end End an ongoing shift
-n, --now End shift now
-t, --time <TIME> End shift at the specified time. Time should have a format of HH:MM:SS orHH:MM
-h, --help Print help
break-start Take a break from an ongoing shift
-n, --now Start a break now
-t, --time <TIME> Start a break at the specified time. Time should have a format ofHH:MM:SS or HH:MM
-d, --duration <DURATION> Start a break and end it after the specified duration. Duration should have a format of <hours>h<minutes>m<seconds>s, <hours>h<minutes>m or <hours>h
-e, --end <END> The started shift should end at <END> (HH:MM:SS or HH:MM)
-h, --help Print help
break-end End an ongoing break
-n, --now End break now
-t, --time <TIME> End break at the specified time. Time should have a format of HH:MM:SS or HH:MM
-h, --help Print help
auto Manage shifts and breaks automatically
-n, --now Start to work now, take a break, go home. Uses the default duration if <DURATION> or <END> is not given
-d, --duration <DURATION> Start a shift now if <NOW> is set or at <START> with the given duration, also takes an appropriately sized break. Duration should have a format of <hours>h<minutes>m<seconds>s, <hours>h<minutes>m or <hours>h
--start <START> Start a shift at <START> until <END> or with a given <DURATION>. If neither is present the default duration is used. Time should be formated like HH:MM:SS or HH:MM
--end <END> If <START> is given, start a shift lasting until <STOP>. mutuallyexclusive with <DURATION>. (HH:MM:SS or HH:MM)
--from <FROM> Start a shift everyday starting at <FROM> and until <TO> using either <START> and <STOP> or <DURATION> or the default value for durations. Dates should be formatted like DD.MM.YYYY or YYYY-MM-DD
--to <TO> Requires <FROM>. (DD.MM.YYYY or YYYY-MM-DD)
-f, --force Override existing shifts
-r, --randomize Add a random offset to all time related values
-h, --help Print help
config Configure tracktorial
-e, --email <EMAIL> Set your email address
-r, --reset-password Reset your password
--rand-range <RAND_RANGE> Set the maximum amount of deviation in minutes from specifiedtimes and durations when the randomization option is enabled
-h, --help Print help
help Print this message or the help of the given subcommand(s)
示例
现在开始班次
tracktorial shift-start --now
在12:30开始休息
tracktorial break-start --time 12:30
在13:00继续工作,工作4小时30分钟后再打卡
tracktorial shift-start --time 13:00 --duration 4h30m
在7:30开始工作,工作8小时,中间休息一会儿
tracktorial auto --start 7:30 --duration 8h
从2024年5月1日到2024年5月31日每天8:00开始工作8小时,并覆盖此时间段内的现有班次,还应用随机偏移以避免显得过于一致
tracktorial auto --start 8:00 --duration 8h --from 01.05.2024 --to 31.05.2024 --force --randomize
安装
使用Cargo
- 使用操作系统包管理器或使用rustup安装rust工具链或cargo。
- 安装Tracktorial
cargo install tracktorial
下载版本
下载最新版本。版本包括Linux和Windows的可执行文件。MacOS用户需要从源代码构建应用程序。为了方便,建议将应用程序添加到PATH环境变量中。
从源代码构建
- 安装rust工具链
- 克隆仓库
git clone https://github.com/antoniomikley/tracktorial
- 切换到仓库目录
cd tracktorial
- 构建应用程序
cargo build --release
- 这将在
target/release/tracktorial
生成可执行文件
为了方便,建议将应用程序添加到PATH环境变量中。可以使用cargo test
运行测试,并使用cargo doc
生成文档。
配置
可以通过CLI或配置文件配置Tracktorial。根据您的操作系统,配置文件可能位于不同的位置
- Linux:
$HOME/.config/tracktorial/config.json
- macOS:
$HOME/Library/Application Support/Tracktorial/config.json
- Windows:
%localappdata%\Tracktorial\config\config.json
配置文件必须是有效的JSON,这意味着当前不支持注释。所有选项在程序首次运行时以及用户输入电子邮件地址和密码时填充,但一个最小的工作示例可能如下所示
{
"email": "[email protected]"
}
一个完整的示例可能如下所示
{
"email": "[email protected]",
"location_type": "office",
"user_id": "1231234",
"working_hours": 40.0,
"working_week_days": [
"monday",
"tuesday",
"wednesday",
"thursday",
"friday"
],
"shift_duration": 8.0,
"max_rand_range": 30
}
无效的配置可能导致应用程序崩溃。如果更新引入了配置文件的破坏性更改或用户做出的更改导致配置损坏,那么将配置减少到最小工作示例可能可以修复问题。删除文件可以达到类似的效果,但需要用户重新登录。
配置选项
email
:用户的电子邮件地址location_type
:可以是“office”或“work_from_home”user_id
:用户在Factorial中的ID。无需手动输入或修改此值working_hours
:用户在一周内承诺工作的小时数,如果设置为0.0,tracktorial将查询factorial并填充此值working_week_days
:用户承诺工作的星期几,tracktorial将自动填充此值shift_duration
:使用auto
子命令时每天工作的小时数。默认值为working_hours除以working_week_days的长度max_rand_range
:使用auto
子命令和--randomize
标志时,在n分钟内应用于你的时钟的随机偏移量
依赖项
~9-24MB
~321K SLoC