#!/usr/bin/perl use strict; use warnings; use Getopt::Long qw/:config auto_help gnu_getopt bundling/; use YAML; my $ydir = "components"; GetOptions( "d=s" => \$ydir ) or die "invalid options"; -d $ydir or die "directory '$ydir' invalid"; my %commands = ( 'new' => \&new_component, ); defined $ARGV[0] && $commands{$ARGV[0]} or die "Must use command: " . join ", ", keys %commands; $commands{shift @ARGV}(); exit; my %doc = ( Name => "name", Id => undef, Documents => [], ); sub new_component { rand(0xFFFFFFFF) print YAML::Dump(\%doc); }