summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--locales/help_docs/en.yml11
-rw-r--r--locales/help_docs/zh-CN.yml11
-rw-r--r--scripts/completions/bash/completion_jv.sh10
-rw-r--r--scripts/completions/powershell/completion_jv.ps111
-rw-r--r--src/bin/jv.rs21
5 files changed, 60 insertions, 4 deletions
diff --git a/locales/help_docs/en.yml b/locales/help_docs/en.yml
index e7e049d..31544ef 100644
--- a/locales/help_docs/en.yml
+++ b/locales/help_docs/en.yml
@@ -260,7 +260,7 @@ jv:
**CONTEXT**:
here - Display path information
status - Display current sheet status information
- info - Display individual file status
+ info <FILE_PATH> - Display individual file status
**FILE TRANSFER**:
share <FILE> <SHEET> <DESC> - Share files to other sheet [[cyan]][REMOTE][[/]]
@@ -369,6 +369,15 @@ jv:
This is a quick way to understand the current file status of the sheet.
+ info: |
+ **Display File Details**
+ **Usage**: jv info <FILE_PATH>
+
+ Display detailed information about the specified file, including:
+ - File's change history
+ - File's mapping in `ref`
+ - File's version in `ref`
+
track: |
**Track or Pull Files**
**Usage**: jv track <FILE_PATH>
diff --git a/locales/help_docs/zh-CN.yml b/locales/help_docs/zh-CN.yml
index c5e17ce..1bafb1a 100644
--- a/locales/help_docs/zh-CN.yml
+++ b/locales/help_docs/zh-CN.yml
@@ -252,7 +252,7 @@ jv:
**上下文查询**:
here - 显示当前路径的相关信息
status - 显示当前表的状态信息
- info - 显示单个文件的状态
+ info <文件> - 显示单个文件的状态
**文件传递**:
share <文件> <表> <描述> - 分享当前上下文的文件至其他表 [[cyan]][远程][[/]]
@@ -361,6 +361,15 @@ jv:
这是了解当前表文件状态的快速方式
+ info: |
+ **显示文件详细信息**
+ **用法**:jv info <文件路径>
+
+ 显示指定文件的详细信息,包括:
+ - 文件的历史变更
+ - 文件在 `ref` 中的位置
+ - 文件在 `ref` 中的版本
+
track: |
**追踪或拉取文件**
**用法**:jv track <文件路径>
diff --git a/scripts/completions/bash/completion_jv.sh b/scripts/completions/bash/completion_jv.sh
index 604fb8c..d6743e7 100644
--- a/scripts/completions/bash/completion_jv.sh
+++ b/scripts/completions/bash/completion_jv.sh
@@ -18,7 +18,7 @@ _jv_completion() {
local base_commands="create init direct unstain account update \
sheet status here move mv docs exit use sheets accounts \
as make drop track hold throw login \
- jump align"
+ jump align info"
# Subcommands - Account
local account_commands="list as add remove movekey mvkey mvk genpub help"
@@ -181,6 +181,14 @@ _jv_completion() {
return 0
fi
+ # Completion info
+ if [[ "$subcmd" == "info" ]]; then
+ if [[ $cword -eq 2 ]]; then
+ COMPREPLY=($(compgen -f -- "$cur"))
+ fi
+ return 0
+ fi
+
# aliases
case "$subcmd" in
"as")
diff --git a/scripts/completions/powershell/completion_jv.ps1 b/scripts/completions/powershell/completion_jv.ps1
index 46a56cc..5027a35 100644
--- a/scripts/completions/powershell/completion_jv.ps1
+++ b/scripts/completions/powershell/completion_jv.ps1
@@ -16,7 +16,7 @@ Register-ArgumentCompleter -Native -CommandName jv -ScriptBlock {
"create", "init", "direct", "unstain", "account", "update",
"sheet", "status", "here", "move", "mv", "docs", "exit", "use", "sheets", "accounts",
"as", "make", "drop", "track", "hold", "throw", "login",
- "jump", "align"
+ "jump", "align", "info"
)
# Account subcommands
@@ -166,6 +166,15 @@ Register-ArgumentCompleter -Native -CommandName jv -ScriptBlock {
return @()
}
+ # Completion for info command
+ if ($subcmd -eq "info") {
+ if ($currentIndex -eq 2) {
+ # File completion for the file argument
+ return Get-ChildItem -Name -File -Path "." | Where-Object { $_ -like "$wordToComplete*" }
+ }
+ return @()
+ }
+
# Aliases completion
switch ($subcmd) {
"as" {
diff --git a/src/bin/jv.rs b/src/bin/jv.rs
index 09dfae2..128c910 100644
--- a/src/bin/jv.rs
+++ b/src/bin/jv.rs
@@ -143,6 +143,9 @@ enum JustEnoughVcsWorkspaceCommand {
#[command(alias = "s")]
Status(StatusArgs),
+ /// Display detailed information about the specified file
+ Info(InfoArgs),
+
// Sheet management
/// Manage sheets in the workspace
#[command(subcommand, alias = "sh")]
@@ -460,6 +463,15 @@ struct StatusArgs {
}
#[derive(Parser, Debug)]
+struct InfoArgs {
+ /// Show help information
+ #[arg(short, long)]
+ help: bool,
+
+ file_pattern: Option<String>,
+}
+
+#[derive(Parser, Debug)]
struct AccountAddArgs {
/// Show help information
#[arg(short, long)]
@@ -1022,6 +1034,13 @@ async fn main() {
}
jv_status(status_args).await;
}
+ JustEnoughVcsWorkspaceCommand::Info(info_args) => {
+ if info_args.help {
+ println!("{}", md(t!("jv.info")));
+ return;
+ }
+ jv_info(info_args).await;
+ }
JustEnoughVcsWorkspaceCommand::Sheet(sheet_manage) => match sheet_manage {
SheetManage::Help => {
println!("{}", md(t!("jv.sheet")));
@@ -1983,6 +2002,8 @@ async fn jv_status(_args: StatusArgs) {
}
}
+async fn jv_info(args: InfoArgs) {}
+
async fn jv_sheet_list(args: SheetListArgs) {
let _ = correct_current_dir();