Giter Club home page Giter Club logo

mklinker's Introduction

Mklinker

Build AppVeyor Build AppVeyor Tests Coverage Report Release NuGet License

Mklinker is a cross-platform console utility that let's you create multiple symbolic / junction / hard links at once based on a single config file.

Table of contents

  1. Why use Mklinker? Who cares about symbolic links?
  2. Installation
    1. Using NuGet (preferred)
    2. Using pre-compiled binaries
    3. From source code
  3. How do I use Mklinker?
  4. Features
  5. Contributing

Why use Mklinker? Who cares about symbolic links?

  • With Mklinker you can keep the config file around and if you for example re-install your operating system you can just use Mklinker and restore all the various links you had before. This is especially useful if you are using a syncing program like Dropbox as it allows you to easily add links to outside folders like AppData, Program Files or My Documents
  • With Mklinker you can easily setup outside references in your projects (you're welcome to use it in your own github repos!)
  • With Mklinker you can send someone the config file and they can easily create all the links
  • Mklinker is cross-platform (windows, linux, mac)

Installation

Using NuGet (preferred)

Installing using NuGet is the easiest and preferred way as it allows you to call mklinker commands globally from command-line. Note that you need .NET Core 3.1 SDK installed

Instructions

  1. Go to NuGet package here
  2. Run command listed under .NET CLI to install the latest version of Mklinker as a global tool.

You can then run mklinker from the command-line globally. If you want to install a previous version you can run dotnet tool install --global Mklinker --version x.y.z instead (x.y.z is version number). It is also possible to install as a local tool if you exclude --global from the command.

Using pre-compiled binaries

Using pre-compiled binaries is a viable alternative if you do not have the .NET SDK installed and just want to run mklinker locally rather than globally. Note that it is possible to make it available globally, but in order to do so you would have to add the folder where you copy mklinker to the PATH environmental variable or copy mklinker to an existing folder that is specified in the PATH environmental variable.

Instructions

  1. Download the ZIP file from from releases containing Mklinker binaries
  2. Unzip the ZIP file (I personally recommend using 7-Zip for this)
  3. Copy the file for your operating system and architecture and put it into a folder of your choosing. Note that you can safely ignore the .pdb file, you only need to copy the actual binary file

You should now be able to run mklinker commands from the command-line from the same folder that the Mklinker binary file resides in. TIP: You can safely rename the binary file to whatever you want to make it easier to run from command-line.

From source code

If you are a purist or simply paranoid it is possible to compile the binaries yourself from the source code!

Instructions

  1. Clone the repository using git clone https://github.com/rubenchristoffer/Mklinker.git (you need git installed)
  2. Navigate to root folder for Mklinker
  3. Run publish.bat or publish.sh (you need .NET Core 3.1 SDK installed)

The binaries will then be compiled and put into the Mklinker/bin/ folder in the format Mklinker-x.y.z-OS. You can then copy the binaries to wherever you want to install and run Mklinker. See the instructions above Using pre-compiled binaries for more info about what to do with the binaries you just compiled.

How do I use Mklinker?

Run mklinker help to see all verbs / commands and their description. You can also run mklinker help [VERB] or mklinker [VERB] --help in order to get more information about that given verb / command. For example, mklinker help addlink will show you arguments that the addlink verb / command takes.

For more info, check out the Getting started page on the wiki.

Features

  • Supports symbolic, junction and hard links on Windows platform
  • Supports symbolic and hard links on Linux and Mac platforms (junction links will be treated as symbolic links)
  • Supports relative paths in config file, but will turn them into absolute paths when running linking commands.
  • Supports variables for paths (e.g. "C:\Users?User?\Desktop") which means that you can create more dynamic configs. Nested variables (variables inside variables) are also supported.
  • Supports custom config file name (if you don't like 'linker.config')
  • Supports config validation where you can check for errors and warnings
  • Supports interactive mode where you can run multiple commands without mklinker in front
  • Supports a scan command which will help with finding circular paths that can arise due to symbolic directories / junctions pointing to a parent folder. This is important when combining Mklinker with Syncing tools like Dropbox as loops may cause the syncing to go on "forever"
  • Supports adding multiple links at once using optional regex filters that also works for sub-directories (allows for recursion)

Contributing

Anyone is allowed to contribute and it is very appreciated! If you want to contribute, take a look at the CONTRIBUTING guidelines to get started.

mklinker's People

Contributors

rubenchristoffer avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

mklinker's Issues

Remove links based on regex

Would work similar to addlinks command, but instead of adding links it would remove them based on a regex pattern.

Add table view for list command

Currently the formatting of the list command is not ideal and it would be nice to have the ability to create a nicely formatted table by adding a --table / -t option.

Add unit tests

Unit tests would be a good idea to better maintain the program.

Use relative path as default

Currently when you provide an absolute path when adding links it will keep the absolite path, but it would be a good idea to convert it to a relative path by default if possible.

Better validate command

There needs to be a better validate command that takes into account if target file exists or if there are multiple config links with the same target.

Add command for displaying full mklink command

It would be nice to have a command that displays the mklink command (the process call used to create the actual links on the system) in order to better be able to debug when command fails.

Resolve paths from perspective of config file rather than working directory

Currently relative paths are resolved from the perspective of the working directory and not the actual config file. That can lead to trouble when specifying a config file that resides in a different directory than the working directory.

Here's an example of the problem:
Working directory is "/home/user".
Config file is "/home/user/config/config.linker"

If the config has a relative target path "./linkhere" and you run the command mklinker linkall --path /home/user/config/config.linker, then the actual link will be created in "/home/user/linkhere" rather than "/home/user/config/linkhere".

Adding support for variables

It would be nice to be able to have support for custom variables in addition to environmental variables so that you can benefit from more dynamic linking.

Add ability to invert source and target path

This would simply be an option (--invert / -i) that treats source path as target path and vice versa. The reason this is useful is because you might be in a situation where your target path already exists, but your source path does not (for example when re-installing operating system or any other backup situation).

Ability to provide variables via command-line

Currently, variables are located in the actual config file. It would be nice to be able to override variable values (temporarily) by passing in an optional option called --override / -o or something like that.

Could also be useful to add a feature where variable values are supposed to be added through reading console input as well.

Creating custom path parser

Creating a custom path parser makes it possible to add custom syntax in addition to keeping it the same cross-platform.

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.