SatorImaging.DotnetTool.StaticImport 1.0.0

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global SatorImaging.DotnetTool.StaticImport --version 1.0.0
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local SatorImaging.DotnetTool.StaticImport --version 1.0.0
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=SatorImaging.DotnetTool.StaticImport&version=1.0.0
                    
nuke :add-package SatorImaging.DotnetTool.StaticImport --version 1.0.0
                    

img.shields.io nuget-publish.yml   Ask DeepWiki  <sup>🇯🇵 日本語</sup>

static-import is a dotnet cli tool to migrate file(s) from another project, github or public website.

In addition, there are features to modify C# script on migration. See C# Script Options for more details.

Installation

On the command line, enter the following command to install package as a command.

.NET SDK 8.0+ is required

dotnet tool install SatorImaging.DotnetTool.StaticImport -g --prerelease

  * --prerelease is required at this moment.

Basic Usage

Here shows how to migrate files to current folder.

static-import -o "." -i \
    "local-file.cs" \
    "github:user@repo/BRANCH_TAG_OR_COMMIT/path/to/file.cs" \
    "https://gist.githubusercontent.com/..." \  # use raw url to download from gist
    "https://inter.net/path/to/file.cs"

Type static-import --help for more options.

For the use in GitHub Actions, see .github/workflows/tests.yml for details.

In GitHub actions, actions/checkout or git pull won't restore commit date for downloaded files so that -f/--force-overwrite option is required to migrate files from other repos.

GitHub Options

static-import has dedicated scheme for GitHub files.

In contrast to https:, it retrieves correct Last-Modified value from repository.

github:<USER_NAME>@<REPO_NAME>/<REF>/path/to/file.ext
  • REF: branch name, tag or commit hash

If the environment variable GH_TOKEN or GITHUB_TOKEN is defined, it is used for accesss to GitHub.

Here shows how to setup the variable in .yml file.

env:
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

See also: https://docs.github.com/actions/how-tos/security-for-github-actions/security-guides/automatic-token-authentication

C# Script Options

There are options to modify C# script on copying. (original file doesn't change)

  • --internal
    • make declared type visibility to internal.
    • NOTE: doesn't affect on nested types.
  • --namespace <NAME>
    • change namespace.
      • if name ending with ., it will be prepended (ex. Foo. --> Foo.Original.Namespace)
    • NOTE: nested namespace syntaxes leave untouched.
namespace FileScoped;  // 👈 changed

namespace Foo.Bar.Baz  // 👈 changed
{
    namespace Quuuuux  // untouched
    {
        public class MyClass  // 👈 changed
        {
            // untouched
            public enum MyEnum { }
            public struct MyStruct { }
            public record MyRecord { }
            public interface IMyInterface { }
        }
    }
}

License

MIT License

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
1.1.0 170 7/16/2025
1.1.0-rc.2 120 7/16/2025
1.1.0-rc.1 111 7/16/2025
1.0.0 133 7/11/2025
1.0.0-rc.11 117 7/10/2025
1.0.0-rc.10 116 7/10/2025
1.0.0-rc.9 131 7/8/2025
1.0.0-rc.7 123 7/7/2025
1.0.0-rc.6 125 7/7/2025
1.0.0-rc.5 117 7/7/2025
1.0.0-rc.4 112 7/7/2025
1.0.0-rc.3 115 7/7/2025
1.0.0-rc.2 119 7/6/2025
1.0.0-rc.1 116 7/6/2025