Beispiel #1
0
        public override Exceptional Execute(AGraphDSSharp myAGraphDSSharp, ref String myCurrentPath, Dictionary<String, List<AbstractCLIOption>> myOptions, String myInputString)
        {
            if (myAGraphDSSharp == null)
                return new Exceptional(new GraphDSError("myAGraphDSSharp must not be null!"));

            _CancelCommand = false;

            // 1 parameter -> Print the target of the symlink
            if (myOptions.Count == 2)
            {

                var SymlinkLocation = new ObjectLocation(ObjectLocation.ParseString(myCurrentPath), myOptions.ElementAt(1).Value[0].Option);

                if (myAGraphDSSharp.isSymlink(SymlinkLocation).Value == Trinary.TRUE)
                    WriteLine(" -> " + myAGraphDSSharp.GetSymlink(SymlinkLocation));

                else
                    WriteLine("Symlink does not exist!");

            }

            // 2 parameters -> Create new symlink
            else
            {

                var SymlinkLocation = new ObjectLocation(ObjectLocation.ParseString(myCurrentPath), myOptions.ElementAt(1).Value[0].Option);
                var SymlinkTarget   = new ObjectLocation(ObjectLocation.ParseString(myCurrentPath), myOptions.ElementAt(2).Value[0].Option);

                myAGraphDSSharp.AddSymlink(SymlinkLocation, SymlinkTarget);

                WriteLine(SymlinkLocation.ToString() + " -> " + SymlinkTarget.ToString());

            }

            return Exceptional.OK;
        }