-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add entry point for embed-code-go #33
Conversation
@vb-td please review your PR description.
![]() |
@vb-td FYI, I have updated the PR description by using back-ticks where they should be used. Namely, all argument names and values are, by their nature, code. Please keep this in mind next time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vb-td LGTM from my side.
Please see the comments from @dmytro-kashcheiev, if any follow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vb-td LGTM with minor comment.
In this PR the entry point was added.
Now it is possible to run embed-code-go with the two following modes:
Modes are selected by the mandatory
mode
argument. If it is set tocheck
, then the checking for up-to-date is performed. If it is set toembed
, the embedding is performed.The tests for CLI functions are provided as well.
Other changes:
Instruction
The tool can be executed as binary file or as a Go file. In the second case, user must have Go installed. The development version is 1.22.1.
Compiling
For compiling, Go must have been installed as well.
Open terminal and navigate to the directory where
embed_code.go
is located. Then, use the following command to compile the file:This will create an executable file named
embed_code
(orembed_code.exe
on Windows) in the same directory.Usage
To run the
embed_code
binary executable, the following command can be used:To run the
embed_code.go
file, the following command can be used:The available arguments are:
-mode
: mandatory, 'check' to checking for code embeddings to be up-to-date; 'embed' to start the embedding process;-code_root
: optional, path to the root directory containing code files;-docs_root
: optional, path to the root directory containing documentation files;-config_file_path
: optional, path to a YAML configuration file that contains the code_root and docs_root fields;-code_includes
: optional, a comma-separated string of glob patterns for code files to include. For example:**/*.java,**/*.gradle
. Default value is**/*.*
;-doc_includes
: optional, a comma-separated string of glob patterns for docs files to include. For example:docs/**/*.md,guides/*.html
. Default value is**/*.md,**/*.html
;-fragments_dir
: optional, a path to a directory with code fragments. Default value is./build/fragments
;-separator
: optional, a string which is used as a separator between code fragments. Default value is...
.Even though
code_root
,docs_root
, andconfig_file_path
arguments are optional, Embed-code still requires root directories for code and docs to be set. This can be done in two ways:code_root
anddocs_root
arguments, in this case roots are read directly from provided paths.config_path
argument, in this case roots are read from the given config file.If both options are missed, the embedding fails. If both options are set, the embedding fails as well.
Examples