Skip to content

Instantly share code, notes, and snippets.

@jerome-diver
Last active July 26, 2017 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jerome-diver/0930e64025f280edd572578540eb8ffe to your computer and use it in GitHub Desktop.
Save jerome-diver/0930e64025f280edd572578540eb8ffe to your computer and use it in GitHub Desktop.
#the sub function where error is, at line 8
our sub object_repo_exist($yaml, $object, $object_name, $group_name) is export
# $ yaml.datas contain the my.yaml parsed file. checked... exactly same structure and content of datas.
{ #give object=title|url , object_name, group_name
my $i = 0;
my %group = $yaml.datas.first: { $_<group> eq $group_name };
my %repo;
unless (%group<repos>.elems == 0) {
return True if %group<repos>.first: { $_<<$object>> eq $object_name };
}
return False;
}
our sub repo_is_correct($yaml, $group_name, $title, $url) is export(:MANDATORY) {
# group_name has been selected and is a string contain the existing name of group (has been selected from a menu)
if ( object_repo_exist( $yaml, "title", $title, $group_name ) ) { return "title exist"; } # call from there...
if ( object_repo_exist( $yaml, "url", $title, $group_name ) ) { return "url exist"; } # and also from there...
unless ( git_repo_exist ( $url ) ) { return "remote repo failed"; }
unless ( prompt-for( "title: $title\nurl: $url\ncorrect ? Do we save this ?", :yn(True) ) ) {
return "want to change" ; }
return "all is ok";
}
---
- group: default
repos: []
- group: try
repos:
- title: air-line
url: https://github.com/vim-airline/vim-airline
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment