capture origin/<name> of active branch in case remote is not tracked
[scpubgit/System-Introspector.git] / bin / system-introspector
CommitLineData
b549a663 1#!/usr/bin/env perl
2use strictures 1;
3
4use Getopt::Long;
5use Pod::Usage;
6use System::Introspector::State;
7use File::Tree::Snapshot;
8use System::Introspector::Config;
9
10GetOptions(
11 'c|config=s' => \my $config_file,
12 's|storage=s' => \my $storage_dir,
b549a663 13 'a|all' => \my $update_all,
14 'g|group=s' => \my @update_groups,
15 'h|help' => sub { pod2usage(0) },
16) or pod2usage(2);
17
b6f45e4f 18die "Requires --storage\n"
19 unless defined $storage_dir;
20
21die "Requires --config\n"
22 unless defined $config_file;
23
b549a663 24die "Requires --all or --group option\n"
25 unless $update_all or @update_groups;
26
27my $config = System::Introspector::Config->new(
28 config_file => (defined($config_file)
29 ? $config_file
30 : "$storage_dir/main.conf"),
31);
32
33$config->has_group($_) or die "Unknown group '$_'\n"
34 for @update_groups;
35
36@update_groups = $config->groups
37 if $update_all;
b079a95d 38
39my $state = System::Introspector::State->new(
40 config => $config,
41 root => $storage_dir,
42);
43
44$state->gather(@update_groups);
b549a663 45
46__END__
47
48=head1 NAME
49
50system-introspector - Generate System Introspection Data
51
52=head1 SYNOPSIS
53
54 system-introspector --storage <path> [OPTIONS]
55
f24afb0e 56=head1 DESCRIPTION
57
58See L<System::Introspector/DESCRIPTION> for more details.
59
b549a663 60=head1 OPTIONS
61
62=head2 -s <path>, --storage <path>
63
64Path to storage. Always required.
65
b6f45e4f 66=head2 -c <file>, --config <file>
67
68Path to the configuration file.
69
70=head2 -a, --all
b549a663 71
b6f45e4f 72Fetch all groups.
b549a663 73
b6f45e4f 74=head2 -g <group>, --group <group>
b549a663 75
b6f45e4f 76Fetch the specified group. Can be used multiple times.
b549a663 77
78=head2 -h, --help
79
80Display help.
81
f24afb0e 82=head1 COPYRIGHT
83
84Copyright (c) 2012 the L<System::Introspector>
85L<AUTHOR|System::Introspector/AUTHOR>,
86L<CONTRIBUTORS|System::Introspector/CONTRIBUTORS> and
87L<SPONSORS|System::Introspector/SPONSORS>.
88
89=head1 LICENSE
90
91This library is free software and may be distributed under the same terms
92as perl itself.
93
b549a663 94=cut