Skip to content

Commit

Permalink
fixup target features.
Browse files Browse the repository at this point in the history
现在应当能编译至 android 平台(比如在 Termux 上)。
  • Loading branch information
worksoup committed Nov 30, 2024
1 parent 08ab12d commit 195314a
Show file tree
Hide file tree
Showing 8 changed files with 390 additions and 364 deletions.
59 changes: 31 additions & 28 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ name = "cxsign"
version = "0.5.0"
edition = "2021"

[lib]
name = "cxsign"
crate-type = ["lib", "cdylib", "staticlib"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features]
default = ["completions"]
Expand Down
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,25 @@ X 星签到的命令行工具,可以为每个课程添加单独的地点。支

**本项目目前主要在 Windows 下测试**

本项目使用跨平台库, 但由于各位同学都只用 Windows, 所以主要在 Windows 上测试。

我也在自己的电脑上测试,故在 Linux 上也应当有良好支持。
- 本项目使用跨平台库,但由于各位同学都只用 Windows, 所以主要在 Windows 上测试。
- 我也在自己的电脑上测试,故在 Linux 上也应当有良好支持。

## 其他注意

- 本项目在没有账号登录的情况下会进行有限的提示,请注意登录你要操作的账号。

- 相较于旧版,本项目的新版本添加了一个排除列表,在第一次运行时会将**超过数月未发签到****还没发过签到**的课程添加进排除列表中,这些课程将不会获取他们签到。
- 相较于旧版,本项目的新版本添加了一个排除列表,在第一次运行时会将**超过数月未发签到****还没发过签到**
的课程添加进排除列表中,这些课程将不会获取他们签到。

如果他们这时新发了签到,本项目将不会获取之。这时需要使用`cxsign list -a` 命令强制列出所有签到或使用 `cxsign list -c <COURSE_ID>` 列出特定课程的签到,此时将会刷新排除列表。
如果他们这时新发了签到,本项目将不会获取之。这时需要使用`cxsign list -a` 命令强制列出所有签到或使用
`cxsign list -c <COURSE_ID>` 列出特定课程的签到,此时将会刷新排除列表。

注意,由于 `cxsign list -a` 命令在旧版本中会出现线程数量过多的现象,新版限制了线程数量,所以该命令耗时较长,为十几秒到数分钟不等。

所以如果只有单个课程新发了签到,建议:

- 先使用 `cxsign course` 列出所有课程。如果你的课程有变动,请添加 `-f, --fresh` 选项。课程太多可以搭配 ripgrep 等使用。
- 然后使用 `cxsign list -c <COURSE_ID>`(注意是**课程号**)列出特定课程的签到,这时本项目会强制获取该课程的签到,如果有新的签到则会将其列出,并将该课程移出排除列表。
- 先使用 `cxsign course` 列出所有课程。如果你的课程有变动,请添加 `-f, --fresh` 选项。课程太多可以搭配 ripgrep 等使用。
- 然后使用 `cxsign list -c <COURSE_ID>`(注意是**课程号**)列出特定课程的签到,这时本项目会强制获取该课程的签到,如果有新的签到则会将其列出,并将该课程移出排除列表。

## 使用方法

Expand Down
2 changes: 2 additions & 0 deletions src/cli/arg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ pub struct Args {
/// 如果是目录,则会选择在该目录下修改日期最新的图片作为拍照签到图片或二维码图片。
#[arg(short, long)]
pub image: Option<PathBuf>,
#[cfg(any(target_os = "linux", target_os = "windows", target_os = "macos"))]
/// 精确地截取二维码。
/// 如果二维码识别过慢可以尝试添加添加此选项。
#[arg(long)]
Expand Down Expand Up @@ -156,6 +157,7 @@ pub struct CliArgs {
pub location_str: Option<String>,
pub image: Option<PathBuf>,
// pub capture: bool,
#[cfg(any(target_os = "linux", target_os = "windows", target_os = "macos"))]
pub precisely: bool,
pub signcode: Option<String>,
}
2 changes: 2 additions & 0 deletions src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ fn match_signs(
location_str,
image,
signcode,
#[cfg(any(target_os = "linux", target_os = "windows", target_os = "macos"))]
precisely,
} = cli_args;
#[allow(clippy::mutable_key_type)]
Expand All @@ -76,6 +77,7 @@ fn match_signs(
location_str,
image,
&None,
#[cfg(any(target_os = "linux", target_os = "windows", target_os = "macos"))]
*precisely,
)
.sign(qs, sessions)?;
Expand Down
Loading

0 comments on commit 195314a

Please sign in to comment.