hancock

Check-in [b975cd947c]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:cmd/hancock: show publish count per directory
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: b975cd947c9e30481430f7f02b1aa390fda748ff99dd1479c4c3a3396d9cbb24
User & Date: dnc 2019-06-07 13:32:42
Context
2019-06-08
21:12
clean up use of command package check-in: 0668aba314 user: dnc tags: trunk
2019-06-07
13:32
cmd/hancock: show publish count per directory check-in: b975cd947c user: dnc tags: trunk
13:32
cmd/hancock: introduce strict mode check-in: 15250ce5f7 user: dnc tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to cmd/hancock/publish.go.

144
145
146
147
148
149
150
151

152
153

154
155
156
157
158
159
160
...
183
184
185
186
187
188
189

190
191
192
193
194
195
196
197
198
199
200
201
		}
	}

	in := command.OperationFlagSet.Args()
	if len(in) == 0 {
		in = append(in, *inFlag)
	}
	count := 0

	// TODO(dnc): concurrency
	for _, fileOrDir := range in {

		err = filepath.Walk(fileOrDir, func(filepath string, info os.FileInfo, err error) error {
			if err != nil {
				return err
			}
			if info.IsDir() {
				return nil // noop, continue walk (we only process files, not directories)
			}
................................................................................
				}
			}
			if indexed {
				count++
			}
			return err
		})

		if err != nil {
			command.Error(err)
		}
	}
	command.V(1).Infof("Published %d items.", count)
	return nil
}

func publishTestimonyToIPFS(ipfsURL string, ft fileTestimony) error {
	err := ipfsAdd(ipfsURL, ft.Bytes(), ft.FileName())
	return err
}







<
>


>







 







>




|







144
145
146
147
148
149
150

151
152
153
154
155
156
157
158
159
160
161
...
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
		}
	}

	in := command.OperationFlagSet.Args()
	if len(in) == 0 {
		in = append(in, *inFlag)
	}


	// TODO(dnc): concurrency
	for _, fileOrDir := range in {
		count := 0
		err = filepath.Walk(fileOrDir, func(filepath string, info os.FileInfo, err error) error {
			if err != nil {
				return err
			}
			if info.IsDir() {
				return nil // noop, continue walk (we only process files, not directories)
			}
................................................................................
				}
			}
			if indexed {
				count++
			}
			return err
		})
		command.V(1).Infof("Published %d items from %q.", count, fileOrDir)
		if err != nil {
			command.Error(err)
		}
	}

	return nil
}

func publishTestimonyToIPFS(ipfsURL string, ft fileTestimony) error {
	err := ipfsAdd(ipfsURL, ft.Bytes(), ft.FileName())
	return err
}