Jesús Pérez b99dcc83c3 feat: major repository modernization and tracking cleanup
## Summary

Comprehensive repository cleanup focusing on plugin dependency management, documentation improvements, and git tracking optimization.

## Key Changes

### 🔧 Core Infrastructure
- Synchronized all nu-* dependencies across plugins for version consistency
- Enhanced upstream tracking and automation systems
- Removed nushell directory from git tracking for cleaner repository management

### 📚 Documentation
- Significantly expanded README.md with comprehensive development guides
- Added detailed workflow documentation and command references
- Improved plugin collection overview and usage examples

### 🧹 Repository Cleanup
- Removed legacy bash scripts (build-all.sh, collect-install.sh, make_plugin.sh)
- Streamlined automation through unified justfile and nushell script approach
- Updated .gitignore with nushell directory and archive patterns
- Removed nushell directory from git tracking to prevent unwanted changes

### 🔌 Plugin Updates
- **nu_plugin_image**: Major refactoring with modular architecture improvements
- **nu_plugin_hashes**: Enhanced functionality and build system improvements
- **nu_plugin_highlight**: Updated for new plugin API compatibility
- **nu_plugin_clipboard**: Dependency synchronization
- **nu_plugin_desktop_notifications**: Version alignment
- **nu_plugin_port_extension & nu_plugin_qr_maker**: Consistency updates
- **nu_plugin_kcl & nu_plugin_tera**: Submodule synchronization

### 🏗️ Git Tracking Optimization
- Removed nushell directory from version control for cleaner repository management
- Added comprehensive .gitignore patterns for build artifacts and archives

## Statistics
- 2,082 files changed
- 2,373 insertions, 339,936 deletions
- Net reduction of 337,563 lines (primarily from removing nushell directory tracking)

## Benefits
- Complete version consistency across all plugins
- Cleaner repository with optimized git tracking
- Improved developer experience with streamlined workflows
- Enhanced documentation and automation
- Reduced repository size and complexity

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-20 15:18:58 +01:00

178 lines
7.9 KiB
Rust

use nu_plugin::{self, EvaluatedCall, Plugin, PluginCommand, SimplePluginCommand};
use nu_plugin_image::{ansi_to_image, image_to_ansi, logging::logger, FontFamily, Palette};
use nu_protocol::{Category, Signature, SyntaxShape, Type, Value};
pub struct ImageConversionPlugin;
impl Plugin for ImageConversionPlugin {
fn commands(&self) -> Vec<Box<dyn PluginCommand<Plugin = Self>>> {
vec![
Box::new(FromPngCommand::new()),
Box::new(ToPngCommand::new()),
]
}
fn version(&self) -> String {
env!("CARGO_PKG_VERSION").into()
}
}
struct FromPngCommand;
impl FromPngCommand {
pub fn new() -> FromPngCommand {
FromPngCommand {}
}
}
impl SimplePluginCommand for FromPngCommand {
type Plugin = ImageConversionPlugin;
fn name(&self) -> &str {
"from png"
}
fn signature(&self) -> Signature {
Signature::build("from png")
.named(
"width",
SyntaxShape::Int,
"Output width, in characters.",
Some('x'),
)
.named(
"height",
SyntaxShape::Int,
"Output height, in characters.",
Some('y'),
)
.named(
"log-level",
SyntaxShape::String,
"sets log level (CRITICAL (c) ERROR (e) WARN (w) INFO (i) DEBUG (d) TRACE (t)) defaults to INFO",
None,
)
.input_output_type(Type::Binary, Type::String)
.category(Category::Conversions)
}
fn description(&self) -> &str {
"create ansi text from an image"
}
fn run(
&self,
_plugin: &Self::Plugin,
_engine: &nu_plugin::EngineInterface,
call: &EvaluatedCall,
input: &Value,
) -> Result<Value, nu_protocol::LabeledError> {
if let Some(Value::String { val, .. }) = call.get_flag_value("log-level") {
logger::set_verbose(val);
}
image_to_ansi(call, input)
}
}
struct ToPngCommand;
impl ToPngCommand {
pub fn new() -> ToPngCommand {
ToPngCommand {}
}
}
impl SimplePluginCommand for ToPngCommand {
type Plugin = ImageConversionPlugin;
fn name(&self) -> &str {
"to png"
}
fn signature(&self) -> nu_protocol::Signature {
Signature::build("to png")
.optional(
"output-path",
SyntaxShape::Filepath,
"output file path (by default uses current timestamp)",
)
.named("width", SyntaxShape::Int, "output width", Some('w'))
.named("theme",SyntaxShape::String,format!("select theme of the output, one of: {:?}\n\t\tby default uses `vscode` theme and you can mix this flag with custom theme colors every other colors will be from the selected theme",Palette::list()),Some('t'))
.named(
"font",
SyntaxShape::String,
format!(
"Select the font from one of {:?}, by default the first font in the list will be used",
FontFamily::list()
),
None,
)
.named("custom-font-regular", SyntaxShape::Filepath, "custom font Regular font path", None)
.named("custom-font-bold", SyntaxShape::Filepath, "custom font Bold font path", None)
.named("custom-font-italic", SyntaxShape::Filepath, "custom font Italic font path", None)
.named("custom-font-bold_italic", SyntaxShape::Filepath, "custom font Bold Italic font path", None)
.named("custom-theme-fg", SyntaxShape::String, "custom foreground color in hex format (0x040404)", None)
.named("custom-theme-bg", SyntaxShape::String, "custom background color in hex format (0x040404)", None)
.named("custom-theme-black", SyntaxShape::String, "custom black color in hex format (0x040404)", None)
.named("custom-theme-red", SyntaxShape::String, "custom red color in hex format (0x040404)", None)
.named("custom-theme-green", SyntaxShape::String, "custom green color in hex format (0x040404)", None)
.named("custom-theme-yellow", SyntaxShape::String, "custom yellow color in hex format (0x040404)", None)
.named("custom-theme-blue", SyntaxShape::String, "custom blue color in hex format (0x040404)", None)
.named("custom-theme-magenta", SyntaxShape::String, "custom magenta color in hex format (0x040404)", None)
.named("custom-theme-cyan", SyntaxShape::String, "custom cyan color in hex format (0x040404)", None)
.named("custom-theme-white", SyntaxShape::String, "custom white color in hex format (0x040404)", None)
.named("custom-theme-bright_black", SyntaxShape::String, "custom bright black color in hex format (0x040404)", None)
.named("custom-theme-bright_red", SyntaxShape::String, "custom bright red color in hex format (0x040404)", None)
.named("custom-theme-bright_green", SyntaxShape::String, "custom bright green color in hex format (0x040404)", None)
.named("custom-theme-bright_yellow", SyntaxShape::String, "custom bright yellow color in hex format (0x040404)", None)
.named("custom-theme-bright_blue", SyntaxShape::String, "custom bright blue color in hex format (0x040404)", None)
.named("custom-theme-bright_magenta", SyntaxShape::String, "custom bright magenta color in hex format (0x040404)", None)
.named("custom-theme-bright_cyan", SyntaxShape::String, "custom bright cyan color in hex format (0x040404)", None)
.named("custom-theme-bright_white", SyntaxShape::String, "custom bright white color in hex format (0x040404)", None)
.named(
"log-level",
SyntaxShape::String,
"sets log level (CRITICAL (c) ERROR (e) WARN (w) INFO (i) DEBUG (d) TRACE (t)) defaults to INFO",
None,
)
.input_output_type(Type::String, Type::String)
// .plugin_examples(
// vec![
// PluginExample{
// description: "creates image of `ls` command's output and save it in the `ls.png` file".to_string(),
// example: "ls | table -c | to png --theme ubuntu --font Ubuntu --output-path ls.png".to_string(),
// result: None,
// },
// PluginExample{
// description: "creates image of `ls` command's output and save it in the `ls.png` file with custom greenish background color".to_string(),
// example: "ls | table -c | to png --theme ubuntu --font Ubuntu --custom-theme-bg 0x112411 --output-path ls.png".to_string(),
// result: None,
// },
// ]
// )
.category(Category::Conversions)
}
fn description(&self) -> &str {
"converts ansi string into png image"
}
fn extra_description(&self) -> &str {
"if you change font and theme they will be used as base theme of the output and every custom flag you provide will override the selected theme or font"
}
fn run(
&self,
_plugin: &Self::Plugin,
engine: &nu_plugin::EngineInterface,
call: &EvaluatedCall,
input: &Value,
) -> Result<Value, nu_protocol::LabeledError> {
if let Some(Value::String { val, .. }) = call.get_flag_value("log-level") {
logger::set_verbose(val);
}
ansi_to_image(engine, call, input)
}
}
fn main() {
nu_plugin::serve_plugin(
&ImageConversionPlugin {},
nu_plugin::MsgPackSerializer {},
)
}