#!/usr/bin/perl

eval 'exec /usr/bin/perl  -S $0 ${1+"$@"}'
    if 0; # not running under some shell
# -*- coding:utf-8-unix; mode:cperl -*-

use strict;
use warnings;

use lib './../lib';

use VineLinux::VSS;
use Getopt::Long;
use File::Spec;

my $vss_home = "$ENV{HOME}/.vine/app/vss";
my $config = "$vss_home/config.yaml";

my $type = '';

GetOptions(
	   '--config=s', \$config,
	   '--type=s' , \$type,
	   '--version' => \my $version
	  );
Getopt::Long::Configure("bundling");

my $package_name = $ARGV[0];

unless (defined $package_name && $package_name =~ m/^.+$/) {
  print "require PACKAGE_NAME\n";
  exit;
}

if ($version) {
  print "vine-spec-skeleton version $VineLinux::VSS::VERSION\n";
  exit;
}

my $app = VineLinux::VSS->new(config => $config, type => $type,
			     package_name => $package_name);
$app->run();
