GithubHelp home page GithubHelp logo

josefpihrt / orang Goto Github PK

View Code? Open in Web Editor NEW
113.0 5.0 10.0 2.17 MB

Search, replace, rename and delete directories, files and its content using the power of .NET regular expressions.

Home Page: https://josefpihrt.github.io/docs/orang

License: Other

C# 99.52% PowerShell 0.48%
cli regex regexp filesystem dotnet-global-tool

orang's Introduction

Console.WriteLine("Hello, World!");

orang's People

Contributors

atifaziz avatar josefpihrt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

orang's Issues

Issue installing Orang

I'm trying to install Orang with dotnet tool install -g orang.dotnet.cli.

I receive the following:

error NU1103: Unable to find a stable package orang.dotnet.cli with version (>= 0.0.0)
error NU1103:   - Found 3 version(s) in nuget.org [ Nearest version: 0.1.0-rc2 ]
error NU1103:   - Found 0 version(s) in Microsoft Visual Studio Offline Packages
error NU1103:   - Found 0 version(s) in C:\Program Files\dotnet\sdk\NuGetFallbackFolder
dotnet : The tool package could not be restored.
At line:1 char:1
+ dotnet tool install -g orang.dotnet.cli
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (The tool package could not be restored.:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
 
Tool 'orang.dotnet.cli' 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.

For more reasons, including package naming enforcement, visit https://aka.ms/failure-installing-tool

Should I just try with the --version switch?

Add new short names

a: attributes
b: attributes-to-skip
c: content
d: dry-run
e: extension
f: filter (MODIFY, CONFLICT)
g: (TARGET, PROGRESS)
h: help
i: include-directory, input
j:
k: (ASK)
l: (CONFLICT, CONTENT-ONLY)
m: max-count, manual
n: name
o: output, options
p: properties
q:
r: replacement
s: sort, section
t: highlight
u: (NO-RECURSE)
v: verbosity, values
w: words
x: (exclude-directory, CONFLICT)
y: display
z:

A:
B:
C:
D:
E:
F:
G:
H:
I:
J:
K:
L:
M:
N:
O:
P:
Q:
R: (NO-RECURSE)
S:
T:
U:
V:
W:
X:
Y:
Z:

Feature request: Allow inline evaluator expressions

From the sample:

using System.Text.RegularExpressions;

namespace N
{
    public static class C
    {
        public static string M(Match match)
        {
            return char.ToUpper(match.Value[0]) + match.Value.Substring(1);
        }
    }
}

The only really relevant part of that class is the logic:

return char.ToUpper(match.Value[0]) + match.Value.Substring(1);

It would be awesome if we could pass such simple logic on the command-line, instead of having to write and compile a full C# DLL. For example, the sample could look like this while providing the same functionality:

orang replace ^
 --extension txt ^
 --content "pattern.txt" from-file ^
 --evaluator "char.ToUpper(match.Value[0]) + match.Value.Substring(1)" ^
 --highlight match replacement ^
 --display path=omit summary ^
 --dry-run

Internally this would use Roslyn to on-the-fly compile the provided expression and execute it. match is the implicit name of the Match, and only a subset of namespaces are implicitly included - I'd suggest System, System.Linq, System.Text, and System.Text.RegularExpressions but you may feel differently.

You could consider adding support for additional command-line-specified namespaces and/or assembly dependencies, much like LINQpad - but I think the relatively simple FR I've outlined here will cover 99% of use-cases, and if users require anything more complex, they can use the current make-your-own-project approach.

find --modify trim breaks other options like line numbers and highlighting

Version Used:
0.5.0.0

Steps to Reproduce:
Create a new file SearchMe.test with the following content:

There is nothing
    on the first
 three lines, but
we FOUND IT on the fourth line
and
  FOUND IT on the sixth line.

Run the following commands to see the difference:

orang find --extension "test" --content "FOUND IT" --line-number
orang find --extension "test" --content "FOUND IT" --line-number --display trim-line
orang find --extension "test" --content "FOUND IT" --line-number --modify trim
orang find --extension "test" --content "FOUND IT" --line-number --modify trim --highlight match

Actual Behavior:
Line numbers and highlighted matches are removed when using --modify trim

image

Expected Behavior:
Using --modify trim should not break other functionality. Documentation says it should only remove whitespace, but it is much more destructive with the output. The --display option is deprecated and shows that message every time you use it, without an option to suppress the deprecation message (at least none that I could find).

Orang.DotNet.Cli 0.2.0 is not compatible with netcoreapp3.1

Version Used: 0.2.0

Steps to Reproduce: Edit any "*.csproj"
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netcoreapp3.1</TargetFramework> </PropertyGroup> <ItemGroup> <PackageReference Include="Orang.DotNet.Cli" Version="0.2.0" /> </ItemGroup> </Project>

Actual Behavior:
NU1202 Package Orang.DotNet.Cli 0.2.0 is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1). Package Orang.DotNet.Cli 0.2.0 supports: netcoreapp3.1 (.NETCoreApp,Version=v3.1)

Expected Behavior:
Installing NuGet package Orang.DotNet.Cli 0.2.0.
Successfully installed 'Orang.DotNet.Cli 0.2.0' to "*.csproj"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.