Skip to content

Devolutions/cirup-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cirup-rs

cirup is a command-line tool for working with localization resource files. It supports .json, .resx, and .restext files.

Quick start

Build the workspace:

cargo build --workspace

Run help:

cargo run -p cirup_cli -- --help

Use an installed binary:

cirup --help

Global options

  • -v, -vv, ...: increase log verbosity.
  • -C, --show-changes: for file-diff, include keys that exist in both files but have different values.
  • --touch: force writing output files even when generated bytes are identical.

By default, cirup avoids rewriting output files when content has not changed.

Common operations

Print a file

cirup file-print input.resx

Write the printed content to a file:

cirup file-print input.resx output.json

Convert between formats

cirup file-convert input.resx output.json
cirup file-convert input.json output.restext

Sort keys

Sort in place:

cirup file-sort strings.json

Sort to a separate file:

cirup file-sort strings.json strings.sorted.json

Diff missing keys

Show keys present in file1 but missing in file2:

cirup file-diff file1.resx file2.resx

Write diff to file:

cirup file-diff file1.resx file2.resx diff.resx

Include value changes as well:

cirup --show-changes file-diff file1.resx file2.resx

Merge values

Merge values from file2 into file1:

cirup file-merge file1.resx file2.resx merged.resx

Intersect files

Keep only exact key/value pairs common to both files:

cirup file-intersect file1.json file2.json intersect.json

Subtract keys

Keep values from file1 whose keys are not in file2:

cirup file-subtract file1.restext file2.restext result.restext

Diff with base file

Show keys that are in new, not in old, and also present in base:

cirup diff-with-base old.resx new.resx base.resx

Output file touch behavior

  • Default: if output bytes are unchanged, cirup does not rewrite the file.
  • With --touch: cirup always rewrites output files.

Examples:

cirup file-sort strings.resx
cirup --touch file-sort strings.resx

NuGet package usage (.NET)

The Devolutions.Cirup.Build package can run cirup operations during MSBuild.

Example project setup:

<ItemGroup>
  <PackageReference Include="Devolutions.Cirup.Build" Version="1.2.3" PrivateAssets="all" />
  <CirupResources Include="Properties\Resources.resx" />
  <CirupResources Include="Properties\Resources.fr.resx" />
</ItemGroup>

Run local end-to-end validation:

pwsh ./nuget/test-e2e.ps1

Dotnet tool usage (.NET 10+)

cirup is also available as a RID-specific dotnet tool package: Devolutions.Cirup.Tool.

Install globally:

dotnet tool install -g Devolutions.Cirup.Tool
cirup --help

Run one-shot without permanent install:

dotnet tool exec Devolutions.Cirup.Tool -- --help
dnx Devolutions.Cirup.Tool --help

Create local dotnet tool packages from prebuilt release artifacts:

pwsh ./nuget/pack-cirup-dotnet-tool.ps1 -Version 1.2.3 -ArtifactsRoot ./dist -OutputDir ./dist/nuget

Quality checks

cargo test --workspace
cargo fmt --all --check
cargo clippy --workspace --all-targets

About

No description, website, or topics provided.

Resources

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors