Inventitech / strans

Performs string manipulation tasks by learning from the provided example(s), instead of having to program them out explicitly.
GNU General Public License v3.0
547 stars 17 forks source link

dotnet global tool #9

Closed drewnoakes closed 5 years ago

drewnoakes commented 5 years ago

Given this is written in C# it'd make a great dotnet global tool.

This would reduce the installation step, across all platforms, to:

$ dotnet tool install -g strans

Further operations:

$ dotnet tool update -g strans
$ dotnet tool uninstall -g strans

https://docs.microsoft.com/en-us/dotnet/core/tools/global-tools https://docs.microsoft.com/en-us/dotnet/core/tools/global-tools-how-to-create

Inventitech commented 5 years ago

Thanks, uploaded here: https://www.nuget.org/packages/strans

(Should be available in an hour or so)

drewnoakes commented 5 years ago

Just tested this and got an error:

$ dotnet tool install -g strans
error NU1212: Invalid project-package combination for strans 0.0.4. DotnetToolReference project style can only contain references of the DotnetTool type
The tool package could not be restored.
Tool 'strans' failed to install. This failure may have been caused by:

* You are attempting to install a preview release and did not use the --version option to specify the version.
* A package by this name was found, but it was not a .NET Core tool.
* The required NuGet feed cannot be accessed, perhaps because of an Internet connection problem.
* You mistyped the name of the tool.
rirze commented 5 years ago

+1 on the error reported by @drewnoakes. Trying to install it on WSL here...

Inventitech commented 5 years ago

Yup, I am aware of the problem. Working on a fix will resume on Tuesday. Thanks for reporting.

Inventitech commented 5 years ago

Ok, it turns out the combination of self-contained exes with PackAsTool does not work. It seems that this will be fixed in some upcoming dotnet version.

The problem: With PackAsTool, we cannot release for linux and macos, without PackAsTool, we cannot, well, pack a valid global dotnet tool.

For now, I will hotpatch the csproj file to contain the flag when generating the NuGet package. Hopefully, this will no longer be necessary in the future.

Inventitech commented 5 years ago

@rirze or @drewnoakes Could you confirm that this works? Thanks!

dotnet tool install -g strans -v n
Build started 3/29/19 5:23:41 PM.
(...)
           CACHE https://api.nuget.org/v3-flatcontainer/strans/index.json
           CACHE https://api.nuget.org/v3-flatcontainer/strans/0.0.5/strans.0.0.5.nupkg
(...)
Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:00.97
You can invoke the tool using the following command: strans
Tool 'strans' (version '0.0.5') was successfully installed.
rirze commented 5 years ago

Yes this works now! Thanks for the fix