Mechanic icon indicating copy to clipboard operation
Mechanic copied to clipboard

Support moving a file relative to it's current position within fsproj file

Open jpierson opened this issue 8 years ago • 0 comments

Concerning the suggested commands that would be supported, in the one in particular that states Move file somewhere below file Y I think it would be useful to consider the default value for Y to be the original file and thus the relative to it's current position.

Moving Constants.fs up one relative to itself:

> forklift up 1 Constants.fs

In this example I used my suggested project name forklift but it could easily be substituted with mech or whichever name is decided upon and the same goes for the up 1 syntax that I just threw out there as an example to work with.

Result:

The effect would be that of moving the file reference for Contants.fs in the following project file up one spot.

<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
+    <Compile Include="Constants.fs" />
    <Compile Include="UsesConstants.fs" />
-    <Compile Include="Constants.fs" />
    <Compile Include="Program.fs" />
  </ItemGroup>
</Project>

If the general approach is reasonable then perhaps the overall brief description for this command could instead something like Move file X somewhere below file Y where Y is optional and is the same as X by default.

How would the above up sub command work with X and Y both supplied? Proposing syntax isn't really the focus of this issue but just to demonstrate that a single sub command could cover both cases of relative translation perhaps one of the examples below would make sense.

Moving Constants.fs up one relative to the position of UsesConstants.fs

Example 1:

> forklift up 1 Constants.fs UsesConstants.fs

Example 2:

> forklift up 1 Constants.fs --from UsesConstants.fs

jpierson avatar Jan 04 '18 04:01 jpierson