#!/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 VineLinux::VSS;
use Getopt::Long;
use File::Spec;

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

my $type = '';

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

if ($version) {
  print "vine-spec-skeleton version $VineLinux::VSS::VERSION\n";
  exit;
} elsif ($init) {
  my $app = VineLinux::VSS->init($config);
} else {
  my $package_name = $ARGV[0];

  unless (defined $package_name && $package_name =~ m/^.+$/) {
    print "require PACKAGE_NAME\n";
    exit;
  }
  my $app = VineLinux::VSS->new(config => $config, type => $type,
				package_name => $package_name);
  $app->run();
}
