Skip to content

Commit 59abc03

Browse files
committed
Documentation created automatically
1 parent bcc3a94 commit 59abc03

32 files changed

+664
-27
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,7 @@
1919

2020
# Go workspace file
2121
go.work
22+
23+
# Runtime configuration files
24+
.alfresco
25+
alfresco.log

Makefile

+5-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ LINUX=$(EXECUTABLE)_linux_amd64
44
DARWIN=$(EXECUTABLE)_darwin_arm64
55
VERSION=$(shell git describe --tags --always --long --dirty)
66

7-
.PHONY: all test clean
7+
.PHONY: all test clean docs
88

9-
all: test build
9+
all: test build docs
1010

1111
build: test windows linux darwin
1212
@echo version: $(VERSION)
@@ -29,6 +29,9 @@ $(DARWIN):
2929
test:
3030
cd test && ./test_node.sh
3131

32+
docs:
33+
go build ./docs/generate/generate.go && cd docs/generate && ./generate
34+
3235
clean:
3336
go clean
3437
rm -f $(WINDOWS) $(LINUX) $(DARWIN)

README.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -171,13 +171,15 @@ a8e32ff6-6140-4a19-84a5-c157820fc376
171171

172172
Sample bash scripts for testing purposes are provided in [test](test) folder.
173173

174+
## Documentation
175+
176+
Detailed documentation is available in [docs/alfresco.md](docs/alfresco.md)
177+
174178
## TODO
175179

176-
* Automated testing
177180
* Site commands
178181
* Person commands
179182
* Group commands
180183
* Search commands
181184
* Provide pre-built programs for Windows, Linux, Mac AMD64 & Mac ARM64
182-
* Control concurrency rate
183-
* [Generate documentation automatically](https://github.com/spf13/cobra/blob/main/doc/md_docs.md)
185+
* Control concurrency rate

cmd/config/config.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ import (
77

88
var ConfigCmd = &cobra.Command{
99
Use: "config",
10-
Short: "Connection details",
10+
Short: "Manage ACS connection details",
11+
Long: `ACS Client configuration is stored on a local ".alfresco" file.
12+
Credentials (username and password) are stored on a Native Store depending on the OS.
13+
The access to the Native Store may require typing OS credentials.`,
1114
}
1215

1316
func init() {

cmd/config/delete.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ const ConfigDeleteCmdId string = "[CONFIG DELETE]"
1313

1414
var configDeleteCmd = &cobra.Command{
1515
Use: "delete",
16-
Short: "Connection details removal",
16+
Short: "ACS connection details removal",
17+
Long: `ACS Client configuration is removed from local ".alfresco" file.
18+
Credentials (username and password) are removed from Native Store.`,
1719
Run: func(command *cobra.Command, args []string) {
1820
storedServer := viper.GetString(nativestore.UrlLabel)
1921
_err := nativestore.Delete(storedServer)

cmd/config/get.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ const ConfigGetCmdId string = "[CONFIG GET]"
1414

1515
var configGetCmd = &cobra.Command{
1616
Use: "get",
17-
Short: "Get connection details",
17+
Short: "Get ACS connection details",
18+
Long: `ACS Client configuration and credentials are retrieved.
19+
The access to the Native Store may require typing OS credentials.`,
1820
Run: func(command *cobra.Command, args []string) {
1921
storedServer := viper.GetString(nativestore.UrlLabel)
2022
username, password, _err := nativestore.Get(storedServer)

cmd/config/set.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ var insecure bool
1919
var maxItems int
2020
var configSetCmd = &cobra.Command{
2121
Use: "set",
22-
Short: "Connection details storage",
22+
Short: "ACS connection details storage",
23+
Long: `ACS Client configuration is stored on a local ".alfresco" file.
24+
Credentials (username and password) are stored on a Native Store depending on the OS.
25+
The access to the Native Store may require typing OS credentials.
26+
When using TLS, "insecure" flag can be set to "true" to allow connections to ACS servers using self-signed certificates.`,
2327
Run: func(command *cobra.Command, args []string) {
2428
_err := nativestore.Set(server, username, password)
2529
if _err != nil {

cmd/node/create.go

+10-7
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,10 @@ var propertiesCreate []string
7878
var fileNameCreate string
7979
var nodeCreateCmd = &cobra.Command{
8080
Use: "create",
81-
Short: "Create new Node",
81+
Short: "Create new Node in ACS Repository",
82+
Long: `Creates a new node as children of a parent node in the repository.
83+
The node can be created setting only metadata (name, type, aspects and properties) or
84+
a local file can be also specified to be associated as the content of the new node.`,
8285
Run: func(command *cobra.Command, args []string) {
8386
CreateNode(nodeId,
8487
nodeNameCreate,
@@ -96,12 +99,12 @@ var nodeCreateCmd = &cobra.Command{
9699

97100
func init() {
98101
nodeCmd.AddCommand(nodeCreateCmd)
99-
nodeCreateCmd.Flags().StringVarP(&nodeId, "nodeId", "i", "", "Parent Node Id in Alfresco Repository. The node is created under this Parent Node. You can also use one of these well-known aliases: -my-, -shared-, -root-")
100-
nodeCreateCmd.Flags().StringVarP(&relativePath, "relativePath", "r", "", "A path in Alfresco Repository relative to the nodeId.")
101-
nodeCreateCmd.Flags().StringVarP(&nodeNameCreate, "name", "n", "", "Node Name")
102-
nodeCreateCmd.Flags().StringVarP(&nodeTypeCreate, "type", "t", "", "Node Type")
103-
nodeCreateCmd.Flags().StringArrayVarP(&aspectsCreate, "aspects", "a", nil, "Complete aspect list to be set")
104-
nodeCreateCmd.Flags().StringArrayVarP(&propertiesCreate, "properties", "p", nil, "Property=Value list containing properties to be updated")
102+
nodeCreateCmd.Flags().StringVarP(&nodeId, "nodeId", "i", "", "Parent Node Id in Alfresco Repository (commonly a folder node). The node is created under this Parent Node. You can also use one of these well-known aliases: -my-, -shared-, -root-")
103+
nodeCreateCmd.Flags().StringVarP(&relativePath, "relativePath", "r", "", "A path in Alfresco Repository relative to the nodeId for the Parent Node.")
104+
nodeCreateCmd.Flags().StringVarP(&nodeNameCreate, "name", "n", "", "New Node Name")
105+
nodeCreateCmd.Flags().StringVarP(&nodeTypeCreate, "type", "t", "", "New Node Type")
106+
nodeCreateCmd.Flags().StringArrayVarP(&aspectsCreate, "aspects", "a", nil, "Complete aspect list to be set for the New Node")
107+
nodeCreateCmd.Flags().StringArrayVarP(&propertiesCreate, "properties", "p", nil, "Property=Value list containing properties to be created for the New Node")
105108
nodeCreateCmd.Flags().StringVarP(&fileNameCreate, "file", "f", "", "Filename to be uploaded (complete or local path)")
106109
nodeCreateCmd.Flags().SortFlags = false
107110
nodeCreateCmd.MarkFlagRequired("nodeId")

cmd/node/delete.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ const DeleteNodeCmdId string = "[NODE DELETE]"
1313

1414
var nodeDeleteCmd = &cobra.Command{
1515
Use: "delete",
16-
Short: "Delete Node",
16+
Short: "Delete a Node existing in the repository",
17+
Long: `Removes an existing node from the repository.
18+
Both metadata and content resources are removed.`,
1719
Run: func(command *cobra.Command, args []string) {
1820
if relativePath != "" {
1921
nodeId = GetNodeId(nodeId, relativePath)

cmd/node/download-folder.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ var folderNameDownload string
5858
var wgDownload sync.WaitGroup
5959
var nodeDownloadFolderCmd = &cobra.Command{
6060
Use: "download-folder",
61-
Short: "Download Alfresco Repository folder to local folder",
61+
Short: "Download an Alfresco Repository folder to a local folder",
62+
Long: `Folders and files nodes from the repository are retrieved recursively.
63+
Only content is downloaded, while metadata is not available on the local download`,
6264
Run: func(command *cobra.Command, args []string) {
6365

6466
log.Println(NodeUploadFolderCmdId,
@@ -83,6 +85,6 @@ func init() {
8385
nodeCmd.AddCommand(nodeDownloadFolderCmd)
8486
nodeDownloadFolderCmd.Flags().StringVarP(&nodeId, "nodeId", "i", "", "Node Id in Alfresco Repository to download to local folder. You can also use one of these well-known aliases: -my-, -shared-, -root-")
8587
nodeDownloadFolderCmd.Flags().StringVarP(&relativePath, "relativePath", "r", "", "A path in Alfresco Repository relative to the nodeId.")
86-
nodeDownloadFolderCmd.Flags().StringVarP(&folderNameDownload, "directory", "d", "", "Folder to download Alfresco content")
88+
nodeDownloadFolderCmd.Flags().StringVarP(&folderNameDownload, "directory", "d", "", "Local folder path to download Alfresco content")
8789
nodeDownloadFolderCmd.MarkFlagRequired("nodeId")
8890
}

cmd/node/get.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@ func GetNodeContent(
6363
var downloadFolderName string
6464
var nodeGetCmd = &cobra.Command{
6565
Use: "get",
66-
Short: "Get Node information (properties and content)",
66+
Short: "Get Node information (properties and content) from repository",
67+
Long: `Metadata and content of a Node is downloaded.
68+
Metadata is provided as output of the command.
69+
Content is retrieved optionally (only when "d" flag is populated).`,
6770
Run: func(command *cobra.Command, args []string) {
6871

6972
GetNodeProperties(nodeId, relativePath, &responseBody)

cmd/node/list.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,11 @@ var skipCount int
4848
var maxItems int
4949
var nodeChildrenCmd = &cobra.Command{
5050
Use: "list",
51-
Short: "Get children nodes",
51+
Short: "Get children nodes from a Node in the repository",
52+
Long: `Metadata List for direct children nodes of a Node in the repository.
53+
Metadata List is provided as output of the command.
54+
If list elements count is greater than "maxItems" flag, output includes "HasMoreItems" field set to true.
55+
Incrementing the "skipCount" flag on a loop will allow to retrieve all the children nodes.`,
5256
Run: func(command *cobra.Command, args []string) {
5357
if maxItems == -1 {
5458
maxItems = viper.GetInt(nativestore.MaxItemsLabel)

cmd/node/node.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ var relativePath string
3030
var responseBody bytes.Buffer
3131
var nodeCmd = &cobra.Command{
3232
Use: "node",
33-
Short: "Manage nodes",
33+
Short: "Manage nodes in ACS Repository",
34+
Long: `ACS Repository handles a set of Nodes of different types (folders, files...)
35+
This command provides the ability to create, update, retrieve and delete ACS Nodes.`,
3436
PersistentPostRun: func(command *cobra.Command, args []string) {
3537
var format, _ = command.Flags().GetString("output")
3638
output(responseBody.Bytes(), format)

cmd/node/update.go

+7-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ var properties []string
2121
var fileNameUpdate string
2222
var nodeUpdateCmd = &cobra.Command{
2323
Use: "update",
24-
Short: "Update Node information",
24+
Short: "Update Node information in the repository",
25+
Long: `Updates an existing node in the repository.
26+
The node can be updating setting only modified metadata (name, type and properties) but
27+
to modify "aspects" the full list of "aspects" to be set to the node is required.
28+
A local file can be also specified to be replace the content of the new node.`,
2529
Run: func(command *cobra.Command, args []string) {
2630

2731
if relativePath != "" {
@@ -83,8 +87,8 @@ func init() {
8387
nodeCmd.AddCommand(nodeUpdateCmd)
8488
nodeUpdateCmd.Flags().StringVarP(&nodeId, "nodeId", "i", "", "Node Id in Alfresco Repository to be updated. You can also use one of these well-known aliases: -my-, -shared-, -root-")
8589
nodeUpdateCmd.Flags().StringVarP(&relativePath, "relativePath", "r", "", "A path in Alfresco Repository relative to the nodeId.")
86-
nodeUpdateCmd.Flags().StringVarP(&nodeName, "name", "n", "", "New Node Name")
87-
nodeUpdateCmd.Flags().StringVarP(&nodeType, "type", "t", "", "New Node Type")
90+
nodeUpdateCmd.Flags().StringVarP(&nodeName, "name", "n", "", "Updated Node Name")
91+
nodeUpdateCmd.Flags().StringVarP(&nodeType, "type", "t", "", "Updated Node Type")
8892
nodeUpdateCmd.Flags().StringArrayVarP(&aspects, "aspects", "a", nil, "Complete aspect list to be set")
8993
nodeUpdateCmd.Flags().StringArrayVarP(&properties, "properties", "p", nil, "Property=Value list containing properties to be updated")
9094
nodeUpdateCmd.Flags().StringVarP(&fileNameUpdate, "file", "f", "", "Filename to be uploaded (complete or local path)")

cmd/node/upload-folder.go

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ var wgUpload sync.WaitGroup
2222
var nodeUploadFolderCmd = &cobra.Command{
2323
Use: "upload-folder",
2424
Short: "Upload local folder to Alfresco Repository",
25+
Long: `Folders and files from local folder are retrieved recursively.
26+
Only content (folders and files) is uploaded, but only basic metadata (name and type) is created in Repository.`,
2527
Run: func(command *cobra.Command, args []string) {
2628

2729
if relativePath != "" {

cmd/root.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ const (
1919

2020
var cfgFile string
2121
var RootCmd = &cobra.Command{
22-
Use: "alfresco",
23-
Short: "A Command Line Interface for Alfresco Content Services.",
22+
Use: "alfresco",
23+
Short: "A Command Line Interface for Alfresco Content Services",
24+
Long: `Alfresco CLI provides access to Alfresco REST API services via command line.
25+
A running ACS server is required to use this program (commonly available in http://localhost:8080/alfresco).`,
2426
Version: "0.0.2",
2527
}
2628

docs/alfresco.md

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
date: 2023-05-04T12:40:28+02:00
3+
title: "alfresco"
4+
slug: alfresco
5+
---
6+
## alfresco
7+
8+
A Command Line Interface for Alfresco Content Services
9+
10+
### Synopsis
11+
12+
Alfresco CLI provides access to Alfresco REST API services via command line.
13+
A running ACS server is required to use this program (commonly available in http://localhost:8080/alfresco).
14+
15+
### Options
16+
17+
```
18+
-h, --help help for alfresco
19+
-o, --output string Output format. E.g.: 'default', 'json' or 'id'. (default "default")
20+
--password string Alfresco Password for the Username (overrides default stored config value)
21+
--username string Alfresco Username (overrides default stored config value)
22+
```
23+
24+
### SEE ALSO
25+
26+
* [alfresco config](/config/alfresco_config.md) - Manage ACS connection details
27+
* [alfresco node](/node/alfresco_node.md) - Manage nodes in ACS Repository
28+

docs/config/alfresco_config.md

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
date: 2023-05-04T12:40:28+02:00
3+
title: "alfresco config"
4+
slug: alfresco_config
5+
---
6+
## alfresco config
7+
8+
Manage ACS connection details
9+
10+
### Synopsis
11+
12+
ACS Client configuration is stored on a local ".alfresco" file.
13+
Credentials (username and password) are stored on a Native Store depending on the OS.
14+
The access to the Native Store may require typing OS credentials.
15+
16+
### Options
17+
18+
```
19+
-h, --help help for config
20+
```
21+
22+
### Options inherited from parent commands
23+
24+
```
25+
-o, --output string Output format. E.g.: 'default', 'json' or 'id'. (default "default")
26+
--password string Alfresco Password for the Username (overrides default stored config value)
27+
--username string Alfresco Username (overrides default stored config value)
28+
```
29+
30+
### SEE ALSO
31+
32+
* [alfresco](../alfresco.md) - A Command Line Interface for Alfresco Content Services
33+
* [alfresco config delete](alfresco_config_delete.md) - ACS connection details removal
34+
* [alfresco config get](alfresco_config_get.md) - Get ACS connection details
35+
* [alfresco config set](alfresco_config_set.md) - ACS connection details storage
36+

docs/config/alfresco_config_delete.md

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
date: 2023-05-04T12:40:28+02:00
3+
title: "alfresco config delete"
4+
slug: alfresco_config_delete
5+
---
6+
## alfresco config delete
7+
8+
ACS connection details removal
9+
10+
### Synopsis
11+
12+
ACS Client configuration is removed from local ".alfresco" file.
13+
Credentials (username and password) are removed from Native Store.
14+
15+
```
16+
alfresco config delete [flags]
17+
```
18+
19+
### Options
20+
21+
```
22+
-h, --help help for delete
23+
```
24+
25+
### Options inherited from parent commands
26+
27+
```
28+
-o, --output string Output format. E.g.: 'default', 'json' or 'id'. (default "default")
29+
--password string Alfresco Password for the Username (overrides default stored config value)
30+
--username string Alfresco Username (overrides default stored config value)
31+
```
32+
33+
### SEE ALSO
34+
35+
* [alfresco config](/alfresco_config.md) - Manage ACS connection details
36+

docs/config/alfresco_config_get.md

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
date: 2023-05-04T12:40:28+02:00
3+
title: "alfresco config get"
4+
slug: alfresco_config_get
5+
---
6+
## alfresco config get
7+
8+
Get ACS connection details
9+
10+
### Synopsis
11+
12+
ACS Client configuration and credentials are retrieved.
13+
The access to the Native Store may require typing OS credentials.
14+
15+
```
16+
alfresco config get [flags]
17+
```
18+
19+
### Options
20+
21+
```
22+
-h, --help help for get
23+
```
24+
25+
### Options inherited from parent commands
26+
27+
```
28+
-o, --output string Output format. E.g.: 'default', 'json' or 'id'. (default "default")
29+
--password string Alfresco Password for the Username (overrides default stored config value)
30+
--username string Alfresco Username (overrides default stored config value)
31+
```
32+
33+
### SEE ALSO
34+
35+
* [alfresco config](/alfresco_config.md) - Manage ACS connection details
36+

0 commit comments

Comments
 (0)