<commit_before>require 'optparse'
require 'vagrant'

module VagrantSnap

    module Command

        class Rollback < Vagrant.plugin("2", :command)

            def execute

                options = {}
                options[:snap_name] = nil

                opts = OptionParser.new do |o|

                    o.banner    = "Usage: vagrant snap rollback [vm-name] [--name=<snapname>]"
                    o.separator ""

                    o.on("--name SNAPNAME", "Roll back to the named snapshot (defaults to last taken)") do |n|
                        options[:snap_name] = n
                    end

                end

                argv = parse_options(opts)
                return if !argv

                with_target_vms(argv) do |vm|

                    unless options[:snap_name].nil?

                        snaps = vm.provider.driver.snapshot_list

                        if snaps.include? /#{options[:snap_name]}/
                            vm.action(:snapshot_rollback, :snap_name => options[:snap_name])
                        else
                            @env.ui.info(I18n.t("vagrant_snap.commands.rollback.output",
                                                :snapshot => options[:snap_name]),
                                        :prefix => false)
                        end

                    else
                        vm.action(:snapshot_rollback, :snap_name => options[:snap_name])
                    end

                end

                0

            end

        end

    end

end<commit_msg>match on string, not regex<commit_after>require 'optparse'
require 'vagrant'

module VagrantSnap

    module Command

        class Rollback < Vagrant.plugin("2", :command)

            def execute

                options = {}
                options[:snap_name] = nil

                opts = OptionParser.new do |o|

                    o.banner    = "Usage: vagrant snap rollback [vm-name] [--name=<snapname>]"
                    o.separator ""

                    o.on("--name SNAPNAME", "Roll back to the named snapshot (defaults to last taken)") do |n|
                        options[:snap_name] = n
                    end

                end

                argv = parse_options(opts)
                return if !argv

                with_target_vms(argv) do |vm|

                    unless options[:snap_name].nil?

                        snaps = vm.provider.driver.snapshot_list

                        if snaps.include? "#{options[:snap_name]}"
                            vm.action(:snapshot_rollback, :snap_name => options[:snap_name])
                        else
                            @env.ui.info(I18n.t("vagrant_snap.commands.rollback.output",
                                                :snapshot => options[:snap_name]),
                                        :prefix => false)
                        end

                    else
                        vm.action(:snapshot_rollback, :snap_name => options[:snap_name])
                    end

                end

                0

            end

        end

    end

end
{'fraction_non_alphanumeric': 0.0868868226995832, 'fraction_numerical': 0.0025649246553382495, 'mean_word_length': 1.0352250489236792, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5661538', 'n_tokens_mistral': 802, 'n_tokens_neox': 722, 'n_words': 169}