Getting Started
Welcome to the "Getting Started" guide for CodeSnap! 🎉 This page will help you get started with CodeSnap, whether you want to use it as a Command Line Interface (CLI) tool or integrate it as a library into your own projects.
Installation
CLI Tool
CodeSnap can be installed using various methods depending on your system:
Arch Linux: Use the command:
bashpacman -S codesnap
Nix/NixOS: Install with:
bashnix-env -i codesnap
Cargo: Run the following command:
bashcargo install codesnap-cli
Alternatively, use the precompiled binary:
bashcargo binstall codesnap-cli
Homebrew: Use:
bashbrew install mistricky/tap/CodeSnap
After installation, you can generate code snapshots with:
codesnap -f ./code_snippet.rs -o "./output.png"
Use codesnap -h
for more options and information.
Library Integration
To add CodeSnap to your Rust project, include it as a dependency via Cargo:
cargo add codesnap
Use CodeSnap's builder pattern to create snapshots:
let code_content = Content::Code(
CodeBuilder::from_text()
.content(r#"print "Hello, World!""#)
.language("python")
.build()?,
);
let snapshot = CodeSnap::from_default_theme()
.content(code_content)
.build()?
.create_snapshot()?;
Check out CodeSnap's examples repository for more detailed usage scenarios. Enjoy creating your code snapshots! 🖼️