#!/usr/bin/perl -w

####!/usr/bin/perl -T -w

use strict ;
use warnings ;
use Carp ;

=head1 NAME 

 $> gvip - gtk based text editor with perl backend

=head1 USAGE

 $> gvip


=head1 OPTIONS

None

=head1 EXIT STATUS

0 if no errors found

=head1 AUTHOR

	Nadim ibn hamouda el Khemir
	CPAN ID: NKH
	mailto: nkh@cpan.org

=cut

#------------------------------------------------------------------------------------------------------------------------

use App::Editor::GVip ;

use Module::Util qw(find_installed) ;
use IO::Select ;

our $VERSION = '0.01' ;

#------------------------------------------------------------------------------------------------------------------------

my @extra_options ;
my $io_select = IO::Select->new(\*STDIN) ;

if($io_select->can_read(0))
	{
	@extra_options = <STDIN> ; ## no critic (InputOutput::ProhibitExplicitStdin)
	chomp @extra_options ;
	}
	
for(@ARGV)
	{
	display_help() if $_ eq '--help' ;
	}
	
#---------------------------------------------------------------------------------------------

my ($basename, $path, $ext) = File::Basename::fileparse(find_installed('App::Editor::GVip'), ('\..*')) ;

my $setup_path = $path . $basename . '/setup/' ;
-e $setup_path or croak "No Setup path in '$path$basename'!" ;

my $editor_app = App::Editor::GVip->new(SETUP_PATH => $setup_path) ;

#~ $editor_app->AddView('gvip.pl') ; # open a file
$editor_app->AddView() ;

$editor_app->show_all();
Gtk2->main();

#------------------------------------------------------------------------------------------------------------------------

sub display_help
{ 
print {*STDERR} `perldoc $0`  or croak 'Can\'t display help!' ; ## no critic (InputOutput::ProhibitBacktickOperators)
exit(1) ;
}
