This allows callers to deal with multiple output formats and not require
string parsing in order to understand what the error was. The default
format is "bsd".
Signed-off-by: Aleksa Sarai <asarai@suse.de>
When checking if a new set is needed (curSet != nil),
curSet wasn't being filtered against the actual keywords
a user specifies. Thus, if `defaultSetKeywords` includes "flags", but
the `keywords` argument for Walk() doesn't include "flags", "flags"
was included in the new \set, which isn't expected behavior. Instead,
we want to use keywordSelector function to make sure that we use
intended user-specified keywords.
Signed-off-by: Stephen Chung <schung@redhat.com>
The FreeBSD flag `-l` is already used and has differing behavior, so
switch to not conflict
Reported-by: Aleksa Sarai <asarai@suse.de>
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
Comments were only ignored if the string parsed
started with "#". This commit trims leading whitespace
and tab characters to make sure all lines with "#" being the
first non-whitespace character are ignored.
Signed-off-by: Stephen Chung <schung@redhat.com>
Fixes#7. Upper 3 bits are 'special' mode bits, and are not
included when calling info.Mode().Perm(). Need to mask
the info.Mode() with the corresponding mode bit defined
by the go library to see if these bits are set or not.
Signed-off-by: Stephen Chung <schung@redhat.com>
Resolves#21. When using `-k` option, gomtree should use
only the keywords specified by the user, as well as the 'type'
keyword if it wasn't specified.
Signed-off-by: Stephen Chung <schung@redhat.com>
When iterating over creator.DH.Entries using the variable
e, and then setting creator.curSet to &e, this causes aliasing
that results in the underlying Entry of creator.curSet to
change on each iteration. Instead we want to get the address of
the actual Entry in creator.DH.Entries.
Signed-off-by: Stephen Chung <schung@redhat.com>
Fixes#11. Check() changes its working directory to `root`, which
is specified as an argument. Thus, it shouldn't open
a file using its absolute path; instead it should open the file
with the relative path to the root.
Signed-off-by: Stephen Chung <schung@redhat.com>
Make sure a keyword is valid before checking if
the keyword exists in the set of KeyVals that
Check() is supposed to validate.
Signed-off-by: Stephen Chung <schung@redhat.com>