Example #1
0
        /// <summary>
        ///     This command is the inverse of <see cref="Push" />: it will restore the pushed state.
        /// </summary>
        /// <param name="configure">Optional settings to control the restore</param>
        public void Pop(Action <VagrantSnapshotRestoreSettings> configure = null)
        {
            var settings = new VagrantSnapshotRestoreSettings(true);

            configure?.Invoke(settings);
            var args = new ProcessArgumentBuilder();

            args.AppendAll("snapshot", "pop");
            settings.GetToolArguments().Invoke(args);
            Runner.Invoke(Settings, args);
        }
Example #2
0
        /// <summary>
        ///     This command restores the named snapshot.
        /// </summary>
        /// <param name="name">Name of the snapshot to restore</param>
        /// <param name="configure">Optional settings to control the restore</param>
        public void Restore(string name, Action <VagrantSnapshotRestoreSettings> configure = null)
        {
            if (!name.HasValue())
            {
                throw new ArgumentNullException(nameof(name));
            }
            var settings = new VagrantSnapshotRestoreSettings();

            configure?.Invoke(settings);
            var args = new ProcessArgumentBuilder();

            args.AppendAll("snapshot", "restore", name ?? string.Empty);
            settings.GetToolArguments().Invoke(args);
            Runner.Invoke(Settings, args);
        }