SciCodePile/SciCode-Domain-Code
DATA1: Domain-Specific Code Dataset Dataset Overview DATA1 is a large-scale domain-specific code dataset focusing on code samples from interdisciplinary fields such as biology, chemistry, materials science, and related areas. The dataset is collected and organized from GitHub repositories, covering 178 different domain topics with over 1.1 billion lines of code. Dataset Statistics Total Datasets: 178 CSV files Total Data Size: ~115 GB Total Lines… See the full description on the dataset page: https://huggingface.co/datasets/SciCodePile/SciCode-Domain-Code.
42.4k
1"keyword","repo_name","file_path","file_extension","file_size","line_count","content","language"
2"Assay","FDA/precisionFDA","LOCAL_INSTALL.md",".md","3325","99","# Localhost setup on OSX 10.11.63 4## Overview5 6To develop on pFDA locally you need to manually add a new user and organization.7Because when you first get started in a new system,8there is no existing user. So you can't log in to provision new accounts.9This requires manually ""bootstrapping"" the situation in steps described in10[pFDA localhost user](#pFDA-localhost-user).11 12## Install13 14### Setup for localhost development on MacOS15 16* Install XCode17 * Search and install XCode from the App Store.18* Install Apple Command Line Tools19 * Open XCode (this just needs to run once to initialize it) and close it.20 * Install XCode command line tools by running `xcode-select --install` in21 the terminal.22* Install [Homebrew](http://brew.sh/)23 * `/usr/bin/ruby -e ""$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)""`24 * Run `brew update` to make sure all your formulas are current25* Install RVM26 * `gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3`27 * `\curl -sSL https://get.rvm.io | bash -s stable`28* Install ruby29 * `rvm install 2.2.3`30* Install bundler31 * `gem install bundler`32 * to keep the current bundler version from Gemfile.lock:33 * `gem install bundler -v 1.16.6`34* Update the `libv8` gem before `bundle i`:35 * `gem install libv8 -v '3.16.14.13' -- --with-system-v8`36* Install git37 * `brew install git`38* Set up git ssh39 * `ssh-keygen -t rsa -b 4096 -C ""your_email@dnanexus.com""`40 * Use `pbcopy < ~/.ssh/id_rsa.pub` to add SSH key to github [here](https://github.com/settings/keys)41* Set up git config42 * `git config --global core.editor ""vim""`43 * `git config --global user.email “your_email@dnanexus.com”`44 * `git config --global user.name “FirstName LastName”`45 * `git config --global push.default simple`46 47### Docker setup48 49* Install Docker and Docker-Compose. See [instructions](https://docs.docker.com/compose/install/)50* Install gems51 * `docker-compose run web bundle install`52* Prepare db53 * `docker-compose run web bundle exec rake db:create`54 * `docker-compose run web bundle exec rake db:schema:load`55* start rails server56 * `docker-compose up`57* start rails console58 * `docker compose exec web bundle exec rails c` 59 60## pFDA setup61 62* Clone Repo63 * `git clone git@github.com:dnanexus/precision-fda.git`64* `bundle install`65* `bundle exec rake db:schema:load`66 67### Issues68 69On your first `bundle`, you may have issues installing the libv8 and70therubyracer gems. See [here](https://github.com/cowboyd/libv8/issues/205) for71potential solutions. Try `bundle update libv8`.72 73Create a User and Org, and other required records by running74 75 76The _dxuser_ of the user record must match your DNAnexus username, and the _handle_ of the org record must77match the DNAnexus org handle without the pfda.. prefix, i.e. floranteorg.78 79## pFDA running80 81* start rails server82 * `bundle exec thin --ssl start`83 * **You must use https, ex: [https://localhost:3000](https://localhost:3000)**84* start rails console85 * `bundle exec rails c`86 87## Dev team Backend Testing88 89* Run all tests90 * `bundle exec rspec`91 92* Run tests with Rspec Guard93 * `bundle exec guard`94 95* To exit from Guard mode:96 * `exit`97 98* Check current code coverage:99 * `open coverage/index.html`100","Markdown"
101"Assay","FDA/precisionFDA","packages/cli/pfda_test.go",".go","25574","803","package main102 103import (104 ""flag""105 ""os""106 ""testing""107 108 ""dnanexus.com/precision-fda-cli/precisionfda""109 ""dnanexus.com/precision-fda-cli/precisionfda/test""110)111 112func TestMain(m *testing.M) {113 // Not the most elegant way of avoiding usage spew in unit test output114 // but works since main uses the default flagset115 flag.Usage = func() {}116 117 // Run tests118 exitVal := m.Run()119 120 // Teardown121 122 // Exit with exit value from tests123 os.Exit(exitVal)124}125 126type InputFlags struct {127 InputFilePath *string128 FilePaths *[]string129 FolderID *string130 SpaceID *string131 AssetFolderPath *string132 AssetName *string133 ReadmeFilePath *string134 FileID *string135 Args *[]string136 Arg *string137 OutputFilePath *string138 EntityID *string139 EntityType *string140 Overwrite *string141 FlagWithProgress bool142 143 // optional flags for ls, list-spaces, download, mkdir, head144 FlagRecursive bool145 FlagHelp bool146 FlagBrief bool147 FlagJson bool148 FlagFoldersOnly bool149 FlagFilesOnly bool150 FlagLocked bool151 FlagUnactivated bool152 FlagPhiProtected bool153 FlagGroups bool154 FlagReview bool155 FlagPrivate bool156 FlagAdministrator bool157 FlagGovernment bool158 FlagParents bool159 FlagPublic bool160 FlagLines int161}162 163func (f *InputFlags) Reset() {164 f.InputFilePath = nil165 f.FilePaths = nil166 f.FolderID = nil167 f.SpaceID = nil168 f.AssetFolderPath = nil169 f.AssetName = nil170 f.ReadmeFilePath = nil171 f.FileID = nil172 f.Args = nil173 f.Arg = nil174 f.OutputFilePath = nil175 f.EntityID = nil176 f.EntityType = nil177 f.FlagRecursive = false178 f.FlagWithProgress = true179 // optional flags - default to false180 f.FlagHelp = false181 f.FlagJson = false182 f.FlagFoldersOnly = false183 f.FlagFilesOnly = false184 f.FlagBrief = false185 f.FlagLocked = false186 f.FlagUnactivated = false187 f.FlagReview = false188 f.FlagGroups = false189 f.FlagPrivate = false190 f.FlagAdministrator = false191 f.FlagGovernment = false192 f.FlagParents = false193 f.FlagPublic = false194 f.FlagLines = 10195}196 197func runMainInternal(surpressStdout bool) int {198 var originalStdout = os.Stdout199 if surpressStdout {200 os.Stdout, _ = os.Open(os.DevNull)201 }202 returnCode := mainInternal()203 if surpressStdout {204 os.Stdout = originalStdout205 }206 return returnCode207}208 209func TestMainNoArgs(t *testing.T) {210 oldArgs := os.Args211 defer func() { os.Args = oldArgs }()212 213 os.Args = []string{""pfda""}214 returnCode := runMainInternal(true)215 test.Equals(t, 1, returnCode)216}217 218func TestWrongCmdError(t *testing.T) {219 oldArgs := os.Args220 defer func() { os.Args = oldArgs }()221 222 os.Args = []string{""pfda"", ""--cmd"", ""foobar""}223 returnCode := runMainInternal(true)224 test.Equals(t, 1, returnCode)225}226 227func TestPositionalCmdInWrongPlace(t *testing.T) {228 oldArgs := os.Args229 defer func() { os.Args = oldArgs }()230 231 var funcWasCalled = false232 invokeDownload = func(client precisionfda.IPFDAClient, args *[]string, folderID *string, spaceID *string, public bool, recursive bool, outputFilePath *string, overwriteFile *string) error {233 funcWasCalled = true234 return nil235 }236 237 os.Args = []string{""pfda"", ""--file-id"", ""file-12345"", ""--key"", ""HELLO"", ""download""}238 returnCode := runMainInternal(true)239 test.Equals(t, 1, returnCode)240 test.Equals(t, false, funcWasCalled)241 242 invokeUploadFile = func(client precisionfda.IPFDAClient, inputFilePath *string, folderID *string, spaceID *string, inputChunkSize *int, inputNumRoutines *int) error {243 funcWasCalled = true244 return nil245 }246 247 os.Args = []string{""pfda"", ""--file"", ""./README.md"", ""--key"", ""HELLO"", ""upload-file""}248 returnCode = runMainInternal(true)249 test.Equals(t, 1, returnCode)250 test.Equals(t, false, funcWasCalled)251}252 253func TestPositionalCmdAndCommandBothSpecified(t *testing.T) {254 oldArgs := os.Args255 defer func() { os.Args = oldArgs }()256 257 var funcWasCalled = false258 invokeUploadFile = func(client precisionfda.IPFDAClient, inputFilePath *string, folderID *string, spaceID *string, inputChunkSize *int, inputNumRoutines *int) error {259 funcWasCalled = true260 return nil261 }262 os.Args = []string{""pfda"", ""upload-file"", ""--cmd"", ""upload-file"", ""--file"", ""./README.md"", ""--key"", ""HELLO""}263 returnCode := runMainInternal(true)264 test.Equals(t, 1, returnCode)265 test.Equals(t, false, funcWasCalled)266}267 268func TestInvokeUploadFile(t *testing.T) {269 oldArgs := os.Args270 defer func() { os.Args = oldArgs }()271 272 var funcWasCalled = false273 input := &InputFlags{}274 var reset = func() {275 funcWasCalled = false276 input.Reset()277 }278 279 invokeUploadFile = func(client precisionfda.IPFDAClient, inputFilePath *string, folderID *string, spaceID *string, inputChunkSize *int, inputNumRoutines *int) error {280 funcWasCalled = true281 input.InputFilePath = inputFilePath282 input.FolderID = folderID283 input.SpaceID = spaceID284 return nil285 }286 287 // Case: --file is missing288 os.Args = []string{""pfda"", ""--cmd"", ""upload-file""}289 returnCode := runMainInternal(true)290 test.Equals(t, 1, returnCode)291 test.Equals(t, false, funcWasCalled)292 reset()293 294 // Case: --file does not exist295 os.Args = []string{""pfda"", ""upload-file"", ""--file"", ""./IDoNot.Exist""}296 returnCode = runMainInternal(true)297 test.Equals(t, 1, returnCode)298 test.Equals(t, false, funcWasCalled)299 test.Equals(t, (*string)(nil), input.InputFilePath)300 reset()301 302 // Case: --file does not exist with --cmd303 os.Args = []string{""pfda"", ""--cmd"", ""upload-file"", ""--file"", ""./IDoNot.Exist""}304 returnCode = runMainInternal(true)305 test.Equals(t, 1, returnCode)306 test.Equals(t, false, funcWasCalled)307 test.Equals(t, (*string)(nil), input.InputFilePath)308 reset()309 310 // Case: upload-file upload success311 os.Args = []string{""pfda"", ""--cmd"", ""upload-file"", ""--file"", ""./README.md"", ""--key"", ""HELLO""}312 returnCode = runMainInternal(false)313 test.Equals(t, 0, returnCode)314 test.Equals(t, true, funcWasCalled)315 test.Equals(t, ""README.md"", *input.InputFilePath)316 reset()317 318 // Case: upload-file success with folder and space319 os.Args = []string{""pfda"", ""upload-file"", ""--file"", ""./Dockerfile"", ""--key"", ""HELLO"", ""--folder-id"", ""test-folder"", ""--space-id"", ""test-space""}320 returnCode = runMainInternal(false)321 test.Equals(t, 0, returnCode)322 test.Equals(t, true, funcWasCalled)323 test.Equals(t, ""Dockerfile"", *input.InputFilePath)324 test.Equals(t, ""test-folder"", *input.FolderID)325 test.Equals(t, ""test-space"", *input.SpaceID)326 reset()327 328 invokeUploadMultipleFiles = func(client precisionfda.IPFDAClient, filePaths *[]string, folderID *string, spaceID *string, inputChunkSize *int, inputNumRoutines *int) error {329 funcWasCalled = true330 input.FilePaths = filePaths331 input.FolderID = folderID332 input.SpaceID = spaceID333 return nil334 }335 336 // Case: upload-file success with multiple files/folders separated by commas337 os.Args = []string{""pfda"", ""upload-file"", ""file1.csv"", ""file2.xlsx"", ""./src/file123.txt"", ""./src/folder123"", ""--key"", ""HELLO""}338 returnCode = runMainInternal(false)339 test.Equals(t, 0, returnCode)340 test.Equals(t, true, funcWasCalled)341 test.Equals(t, []string{""file1.csv"", ""file2.xlsx"", ""./src/file123.txt"", ""./src/folder123""}, *input.FilePaths)342 reset()343 344 // Case: upload-file success with folder and space with --cmd345 os.Args = []string{""pfda"", ""--cmd"", ""upload-file"", ""--file"", ""./Dockerfile"", ""--key"", ""HELLO"", ""--folder-id"", ""test-folder"", ""--space-id"", ""test-space""}346 returnCode = runMainInternal(false)347 test.Equals(t, 0, returnCode)348 test.Equals(t, true, funcWasCalled)349 test.Equals(t, ""Dockerfile"", *input.InputFilePath)350 test.Equals(t, ""test-folder"", *input.FolderID)351 test.Equals(t, ""test-space"", *input.SpaceID)352 reset()353 354 invokeUploadFolder = func(client precisionfda.IPFDAClient, inputFilePath *string, folderID *string, spaceID *string, inputChunkSize *int, inputNumRoutines *int) error {355 funcWasCalled = true356 input.InputFilePath = inputFilePath357 input.FolderID = folderID358 input.SpaceID = spaceID359 return nil360 }361 362 // Case: upload-file with single folder363 os.Args = []string{""pfda"", ""upload-file"", ""helpers/"", ""--key"", ""HELLO""}364 returnCode = runMainInternal(false)365 test.Equals(t, 0, returnCode)366 test.Equals(t, true, funcWasCalled)367 test.Equals(t, ""helpers"", *input.InputFilePath)368 reset()369 370}371 372func TestInvokeUploadAsset(t *testing.T) {373 oldArgs := os.Args374 defer func() { os.Args = oldArgs }()375 376 var funcWasCalled = false377 input := &InputFlags{}378 var reset = func() {379 funcWasCalled = false380 input.Reset()381 }382 383 invokeUploadAsset = func(client precisionfda.IPFDAClient, assetFolderPath *string, assetName *string, readmeFilePath *string, inputChunkSize *int, inputNumRoutines *int) error {384 funcWasCalled = true385 input.AssetFolderPath = assetFolderPath386 input.AssetName = assetName387 input.ReadmeFilePath = readmeFilePath388 return nil389 }390 391 // Case: upload-asset with folder and space392 os.Args = []string{""pfda"", ""upload-asset"", ""--name"", ""test-asset.tar.gz"", ""--key"", ""HELLO"", ""--root"", ""./precisionfda"", ""--readme"", ""./README.md""}393 returnCode := runMainInternal(false)394 test.Equals(t, 0, returnCode)395 test.Equals(t, true, funcWasCalled)396 test.Equals(t, ""./precisionfda"", *input.AssetFolderPath)397 test.Equals(t, ""test-asset.tar.gz"", *input.AssetName)398 test.Equals(t, ""./README.md"", *input.ReadmeFilePath)399 reset()400 401 // Case: upload-asset with folder and space with --cmd402 os.Args = []string{""pfda"", ""--cmd"", ""upload-asset"", ""--name"", ""test-asset.tar.gz"", ""--key"", ""HELLO"", ""--root"", ""./precisionfda"", ""--readme"", ""./README.md""}403 returnCode = runMainInternal(false)404 test.Equals(t, 0, returnCode)405 test.Equals(t, true, funcWasCalled)406 test.Equals(t, ""./precisionfda"", *input.AssetFolderPath)407 test.Equals(t, ""test-asset.tar.gz"", *input.AssetName)408 test.Equals(t, ""./README.md"", *input.ReadmeFilePath)409 reset()410 411 // Case: upload-asset fails if --root doesn't exist412 os.Args = []string{""pfda"", ""upload-asset"", ""--name"", ""test-asset.tar.gz"", ""--key"", ""HELLO"", ""--root"", ""root-folder"", ""--readme"", ""./README.md""}413 returnCode = runMainInternal(false)414 test.Equals(t, 1, returnCode)415 test.Equals(t, false, funcWasCalled)416 test.Equals(t, (*string)(nil), input.AssetFolderPath)417 test.Equals(t, (*string)(nil), input.AssetName)418 test.Equals(t, (*string)(nil), input.ReadmeFilePath)419 reset()420 421 // Case: upload-asset fails if --file doesn't exist422 os.Args = []string{""pfda"", ""upload-asset"", ""--name"", ""test-asset.tar.gz"", ""--key"", ""HELLO"", ""--root"", ""./i-do-not-exist"", ""--readme"", ""./README.md""}423 returnCode = runMainInternal(false)424 test.Equals(t, 1, returnCode)425 test.Equals(t, false, funcWasCalled)426 test.Equals(t, (*string)(nil), input.AssetFolderPath)427 test.Equals(t, (*string)(nil), input.AssetName)428 test.Equals(t, (*string)(nil), input.ReadmeFilePath)429 reset()430 431 // Case: upload-asset with all parameters432 os.Args = []string{""pfda"", ""--cmd"", ""upload-asset"", ""--name"", ""test-asset.tar.gz"", ""--key"", ""HELLO"", ""--root"", ""./"", ""--readme"", ""./README.md""}433 returnCode = runMainInternal(false)434 test.Equals(t, 0, returnCode)435 test.Equals(t, true, funcWasCalled)436 test.Equals(t, ""./"", *input.AssetFolderPath)437 test.Equals(t, ""test-asset.tar.gz"", *input.AssetName)438 test.Equals(t, ""./README.md"", *input.ReadmeFilePath)439 reset()440}441 442func TestInvokeDownloadFile(t *testing.T) {443 oldArgs := os.Args444 defer func() { os.Args = oldArgs }()445 446 var funcWasCalled = false447 input := &InputFlags{}448 var reset = func() {449 funcWasCalled = false450 input.Reset()451 }452 453 invokeDownload = func(client precisionfda.IPFDAClient, args *[]string, folderID *string, spaceID *string, public bool, recursive bool, outputFilePath *string, overwriteFile *string) error {454 funcWasCalled = true455 input.Args = args456 input.FolderID = folderID457 input.SpaceID = spaceID458 input.FlagRecursive = recursive459 input.OutputFilePath = outputFilePath460 input.Overwrite = overwriteFile461 return nil462 }463 464 // Case: download with --cmd465 os.Args = []string{""pfda"", ""--cmd"", ""download"", ""--file-id"", ""file-12345"", ""--key"", ""HELLO""}466 returnCode := runMainInternal(false)467 test.Equals(t, 0, returnCode)468 test.Equals(t, true, funcWasCalled)469 test.Equals(t, []string{""file-12345""}, *input.Args)470 reset()471 472 // Case: download without --cmd, with outputFilePath473 os.Args = []string{""pfda"", ""download"", ""--file-id"", ""file-23456"", ""--key"", ""HELLO"", ""--output"", ""/tmp/canyoupleaseworksoicanbedonefortheday.argh""}474 returnCode = runMainInternal(false)475 test.Equals(t, 0, returnCode)476 test.Equals(t, true, funcWasCalled)477 test.Equals(t, []string{""file-23456""}, *input.Args)478 reset()479 480 // Case: download without --cmd, with -overwrite flag481 os.Args = []string{""pfda"", ""download"", ""--file-id"", ""file-23456"", ""--key"", ""HELLO"", ""--overwrite"", ""true""}482 returnCode = runMainInternal(false)483 test.Equals(t, 0, returnCode)484 test.Equals(t, true, funcWasCalled)485 test.Equals(t, []string{""file-23456""}, *input.Args)486 test.Equals(t, ""true"", *input.Overwrite)487 reset()488 489 // Case: download whole folder with -overwrite and recursive flag490 os.Args = []string{""pfda"", ""download"", ""-folder-id"", ""12223"", ""-key"", ""HELLO"", ""-overwrite"", ""true"", ""-recursive""}491 returnCode = runMainInternal(false)492 test.Equals(t, 0, returnCode)493 test.Equals(t, true, funcWasCalled)494 test.Equals(t, ""12223"", *input.FolderID)495 test.Equals(t, ""true"", *input.Overwrite)496 test.Equals(t, true, input.FlagRecursive)497 reset()498 499 // Case: download without --cmd, with -overwrite flag500 os.Args = []string{""pfda"", ""download"", ""file-23456"", ""file-2221"", ""file-11111"", ""-key"", ""HELLO"", ""-overwrite"", ""true""}501 returnCode = runMainInternal(false)502 test.Equals(t, 0, returnCode)503 test.Equals(t, true, funcWasCalled)504 test.Equals(t, []string{""file-23456"", ""file-2221"", ""file-11111""}, *input.Args)505 test.Equals(t, ""true"", *input.Overwrite)506 reset()507 508}509 510func TestInvokeListing(t *testing.T) {511 oldArgs := os.Args512 defer func() { os.Args = oldArgs }()513 514 var funcWasCalled = false515 input := &InputFlags{}516 var reset = func() {517 funcWasCalled = false518 input.Reset()519 }520 521 invokeListing = func(client precisionfda.IPFDAClient, folderID *string, spaceID *string, flags map[string]bool) error {522 funcWasCalled = true523 input.FolderID = folderID524 input.SpaceID = spaceID525 input.FlagBrief = flags[""brief""]526 input.FlagFilesOnly = flags[""files_only""]527 input.FlagFoldersOnly = flags[""folders_only""]528 input.FlagJson = flags[""json""]529 return nil530 }531 532 // Case: ls without folderID and spaceID and no flags533 os.Args = []string{""pfda"", ""ls"", ""--key"", ""AUTH_KEY""}534 returnCode := runMainInternal(false)535 test.Equals(t, 0, returnCode)536 test.Equals(t, true, funcWasCalled)537 test.Equals(t, false, input.FlagBrief)538 test.Equals(t, false, input.FlagFilesOnly)539 test.Equals(t, false, input.FlagFoldersOnly)540 test.Equals(t, false, input.FlagJson)541 reset()542 543 // Case: ls with help - only show help and do not call the func544 os.Args = []string{""pfda"", ""ls"", ""--help""}545 returnCode = runMainInternal(false)546 test.Equals(t, 1, returnCode)547 test.Equals(t, false, funcWasCalled)548 test.Equals(t, false, input.FlagBrief)549 test.Equals(t, false, input.FlagFilesOnly)550 test.Equals(t, false, input.FlagFoldersOnly)551 test.Equals(t, false, input.FlagJson)552 reset()553 554 // Case: ls return only files in json format555 os.Args = []string{""pfda"", ""ls"", ""--key"", ""AUTH_KEY"", ""--json"", ""--files""}556 returnCode = runMainInternal(false)557 test.Equals(t, 0, returnCode)558 test.Equals(t, true, funcWasCalled)559 test.Equals(t, false, input.FlagBrief)560 test.Equals(t, true, input.FlagFilesOnly)561 test.Equals(t, false, input.FlagFoldersOnly)562 test.Equals(t, true, input.FlagJson)563 reset()564 565 // Case: ls return only folders in brief format566 os.Args = []string{""pfda"", ""ls"", ""--key"", ""AUTH_KEY"", ""--brief"", ""--folders""}567 returnCode = runMainInternal(false)568 test.Equals(t, 0, returnCode)569 test.Equals(t, true, funcWasCalled)570 test.Equals(t, true, input.FlagBrief)571 test.Equals(t, false, input.FlagFilesOnly)572 test.Equals(t, true, input.FlagFoldersOnly)573 test.Equals(t, false, input.FlagJson)574 reset()575}576 577func TestInvokeListSpaces(t *testing.T) {578 oldArgs := os.Args579 defer func() { os.Args = oldArgs }()580 581 var funcWasCalled = false582 input := &InputFlags{}583 var reset = func() {584 funcWasCalled = false585 input.Reset()586 }587 588 invokeListSpaces = func(client precisionfda.IPFDAClient, flags map[string]bool) error {589 funcWasCalled = true590 input.FlagJson = flags[""json""]591 input.FlagLocked = flags[""locked""]592 input.FlagUnactivated = flags[""unactivated""]593 input.FlagReview = flags[""review""]594 input.FlagGroups = flags[""groups""]595 input.FlagPrivate = flags[""private_type""]596 input.FlagAdministrator = flags[""administrator""]597 input.FlagGovernment = flags[""government""]598 return nil599 }600 601 // Case: list-spaces with no flags602 os.Args = []string{""pfda"", ""list-spaces"", ""--key"", ""AUTH_KEY""}603 returnCode := runMainInternal(false)604 test.Equals(t, 0, returnCode)605 test.Equals(t, true, funcWasCalled)606 test.Equals(t, false, input.FlagLocked)607 test.Equals(t, false, input.FlagUnactivated)608 test.Equals(t, false, input.FlagReview)609 test.Equals(t, false, input.FlagGroups)610 test.Equals(t, false, input.FlagPrivate)611 test.Equals(t, false, input.FlagAdministrator)612 test.Equals(t, false, input.FlagGovernment)613 test.Equals(t, false, input.FlagJson)614 reset()615 616 // Case: list-spaces with help - only show help and do not call the func617 os.Args = []string{""pfda"", ""list-spaces"", ""--help""}618 returnCode = runMainInternal(false)619 test.Equals(t, 1, returnCode)620 test.Equals(t, false, funcWasCalled)621 test.Equals(t, false, input.FlagLocked)622 test.Equals(t, false, input.FlagUnactivated)623 test.Equals(t, false, input.FlagReview)624 test.Equals(t, false, input.FlagGroups)625 test.Equals(t, false, input.FlagPrivate)626 test.Equals(t, false, input.FlagAdministrator)627 test.Equals(t, false, input.FlagGovernment)628 test.Equals(t, false, input.FlagJson)629 reset()630 631 // Case: list-spaces only locked and in json format632 os.Args = []string{""pfda"", ""list-spaces"", ""--key"", ""AUTH_KEY"", ""--locked"", ""--json""}633 returnCode = runMainInternal(false)634 test.Equals(t, 0, returnCode)635 test.Equals(t, true, funcWasCalled)636 test.Equals(t, true, input.FlagLocked)637 test.Equals(t, false, input.FlagUnactivated)638 test.Equals(t, false, input.FlagReview)639 test.Equals(t, false, input.FlagGroups)640 test.Equals(t, false, input.FlagPrivate)641 test.Equals(t, false, input.FlagAdministrator)642 test.Equals(t, false, input.FlagGovernment)643 test.Equals(t, true, input.FlagJson)644 reset()645 646 // Case: list spaces - multi-type filter647 os.Args = []string{""pfda"", ""list-spaces"", ""--key"", ""AUTH_KEY"", ""--groups"", ""--private"", ""--administrator"", ""--review"", ""--government""}648 returnCode = runMainInternal(false)649 test.Equals(t, 0, returnCode)650 test.Equals(t, true, funcWasCalled)651 test.Equals(t, false, input.FlagLocked)652 test.Equals(t, false, input.FlagUnactivated)653 test.Equals(t, true, input.FlagReview)654 test.Equals(t, true, input.FlagGroups)655 test.Equals(t, true, input.FlagPrivate)656 test.Equals(t, true, input.FlagAdministrator)657 test.Equals(t, true, input.FlagGovernment)658 test.Equals(t, false, input.FlagJson)659 reset()660}661 662func TestInvokeDescribeEntity(t *testing.T) {663 oldArgs := os.Args664 defer func() { os.Args = oldArgs }()665 666 var funcWasCalled = false667 input := &InputFlags{}668 var reset = func() {669 funcWasCalled = false670 input.Reset()671 }672 673 invokeDescribe = func(client precisionfda.IPFDAClient, entityID *string, entityType *string) error {674 funcWasCalled = true675 input.EntityID = entityID676 input.EntityType = entityType677 return nil678 }679 680 // Case: describe-app entity - old syntax681 os.Args = []string{""pfda"", ""describe-app"", ""--app-id"", ""APP_ID"", ""--key"", ""AUTH_KEY""}682 returnCode := runMainInternal(false)683 test.Equals(t, 0, returnCode)684 test.Equals(t, true, funcWasCalled)685 test.Equals(t, ""APP_ID"", *input.EntityID)686 test.Equals(t, ""app"", *input.EntityType)687 reset()688 689 // Case: describe-app entity - new syntax690 os.Args = []string{""pfda"", ""describe-app"", ""APP_ID"", ""--key"", ""AUTH_KEY""}691 returnCode = runMainInternal(false)692 test.Equals(t, 0, returnCode)693 test.Equals(t, true, funcWasCalled)694 test.Equals(t, ""APP_ID"", *input.EntityID)695 test.Equals(t, ""app"", *input.EntityType)696 reset()697 698 // Case: describe-workflow entity - old syntax699 os.Args = []string{""pfda"", ""describe-workflow"", ""--workflow-id"", ""WORKFLOW_ID"", ""--key"", ""AUTH_KEY""}700 returnCode = runMainInternal(false)701 test.Equals(t, 0, returnCode)702 test.Equals(t, true, funcWasCalled)703 test.Equals(t, ""WORKFLOW_ID"", *input.EntityID)704 test.Equals(t, ""workflow"", *input.EntityType)705 reset()706 707 // Case: describe-workflow entity - new syntax708 os.Args = []string{""pfda"", ""describe-workflow"", ""WORKFLOW_ID"", ""--key"", ""AUTH_KEY""}709 returnCode = runMainInternal(false)710 test.Equals(t, 0, returnCode)711 test.Equals(t, true, funcWasCalled)712 test.Equals(t, ""WORKFLOW_ID"", *input.EntityID)713 test.Equals(t, ""workflow"", *input.EntityType)714 reset()715}716 717func TestInvokeMkdir(t *testing.T) {718 oldArgs := os.Args719 defer func() { os.Args = oldArgs }()720 721 var funcWasCalled = false722 input := &InputFlags{}723 var reset = func() {724 funcWasCalled = false725 input.Reset()726 }727 728 invokeMkdir = func(client precisionfda.IPFDAClient, names *[]string, folderID *string, spaceID *string, parents bool) error {729 funcWasCalled = true730 input.Args = names731 input.FolderID = folderID732 input.SpaceID = spaceID733 input.FlagParents = parents734 return nil735 }736 737 // Case: simple mkdir738 os.Args = []string{""pfda"", ""mkdir"", ""dir1"", ""--key"", ""AUTH_KEY""}739 returnCode := runMainInternal(false)740 test.Equals(t, 0, returnCode)741 test.Equals(t, true, funcWasCalled)742 test.Equals(t, []string{""dir1""}, *input.Args)743 reset()744 745 // Case: mkdir with multiple args746 os.Args = []string{""pfda"", ""mkdir"", ""dir1"",""dir2"", ""dir3"", ""-folder-id"",""123"", ""-space-id"",""333"", ""--key"", ""AUTH_KEY""}747 returnCode = runMainInternal(false)748 test.Equals(t, 0, returnCode)749 test.Equals(t, true, funcWasCalled)750 test.Equals(t, []string{""dir1"", ""dir2"",""dir3""}, *input.Args)751 test.Equals(t, ""123"", *input.FolderID)752 test.Equals(t, ""333"", *input.SpaceID)753 test.Equals(t, false, input.FlagParents)754 reset()755 756 // Case: mkdir nested folders with parents flag757 os.Args = []string{""pfda"", ""mkdir"", ""dir1/dir2/dir3"", ""-p"", ""--key"", ""AUTH_KEY""}758 returnCode = runMainInternal(false)759 test.Equals(t, 0, returnCode)760 test.Equals(t, true, funcWasCalled)761 test.Equals(t, []string{""dir1/dir2/dir3""}, *input.Args)762 test.Equals(t, true, input.FlagParents)763 reset()764}765 766func TestInvokeRmdir(t *testing.T) {767 oldArgs := os.Args768 defer func() { os.Args = oldArgs }()769 770 var funcWasCalled = false771 input := &InputFlags{}772 var reset = func() {773 funcWasCalled = false774 input.Reset()775 }776 777 invokeRmdir = func(client precisionfda.IPFDAClient, args *[]string) error {778 funcWasCalled = true779 input.Args = args780 return nil781 }782 783 // Case: simple mkdir784 os.Args = []string{""pfda"", ""rmdir"", ""123"", ""--key"", ""AUTH_KEY""}785 returnCode := runMainInternal(false)786 test.Equals(t, 0, returnCode)787 test.Equals(t, true, funcWasCalled)788 test.Equals(t, []string{""123""}, *input.Args)789 reset()790 791 // Case: mkdir with multiple args792 os.Args = []string{""pfda"", ""rmdir"", ""123"", ""333"", ""--key"", ""AUTH_KEY""}793 returnCode = runMainInternal(false)794 test.Equals(t, 0, returnCode)795 test.Equals(t, true, funcWasCalled)796 test.Equals(t, []string{""123"", ""333""}, *input.Args)797 798 test.Equals(t, false, input.FlagParents)799 reset()800}801 802func TestInvokeRm(t *testing.T) {803 oldArgs := os.Args804 defer func() { os.Args = oldArgs }()805 806 var funcWasCalled = false807 input := &InputFlags{}808 var reset = func() {809 funcWasCalled = false810 input.Reset()811 }812 813 invokeRm = func(client precisionfda.IPFDAClient, args *[]string,folderID *string, spaceID *string) error {814 funcWasCalled = true815 input.Args = args816 return nil817 }818 819 // Case: simple mkdir820 os.Args = []string{""pfda"", ""rm"", ""123"", ""--key"", ""AUTH_KEY""}821 returnCode := runMainInternal(false)822 test.Equals(t, 0, returnCode)823 test.Equals(t, true, funcWasCalled)824 test.Equals(t, []string{""123""}, *input.Args)825 reset()826 827 // Case: mkdir with multiple args828 os.Args = []string{""pfda"", ""rm"", ""123*"", ""333"", ""--key"", ""AUTH_KEY""}829 returnCode = runMainInternal(false)830 test.Equals(t, 0, returnCode)831 test.Equals(t, true, funcWasCalled)832 test.Equals(t, []string{""123*"", ""333""}, *input.Args)833 834 test.Equals(t, false, input.FlagParents)835 reset()836}837 838func TestInvokeHead(t *testing.T) {839 oldArgs := os.Args840 defer func() { os.Args = oldArgs }()841 842 var funcWasCalled = false843 input := &InputFlags{}844 var reset = func() {845 funcWasCalled = false846 input.Reset()847 }848 849 invokeHead = func(client precisionfda.IPFDAClient, arg *string, lines int) error {850 funcWasCalled = true851 input.Arg = arg852 input.FlagLines = lines853 return nil854 }855 856 // Case: simple mkdir857 os.Args = []string{""pfda"", ""head"", ""testfile.txt"", ""--key"", ""AUTH_KEY""}858 returnCode := runMainInternal(false)859 test.Equals(t, 0, returnCode)860 test.Equals(t, true, funcWasCalled)861 test.Equals(t, ""testfile.txt"", *input.Arg)862 test.Equals(t, 10, input.FlagLines)863 reset()864 865 // Case: mkdir with multiple args866 os.Args = []string{""pfda"", ""head"", ""testfile.txt"", ""-lines"", ""222"", ""--key"", ""AUTH_KEY""}867 returnCode = runMainInternal(false)868 test.Equals(t, 0, returnCode)869 test.Equals(t, true, funcWasCalled)870 test.Equals(t, ""testfile.txt"", *input.Arg)871 test.Equals(t, 222, input.FlagLines)872 reset()873}874 875func TestInvokeCat(t *testing.T) {876 oldArgs := os.Args877 defer func() { os.Args = oldArgs }()878 879 var funcWasCalled = false880 input := &InputFlags{}881 var reset = func() {882 funcWasCalled = false883 input.Reset()884 }885 886 invokeCat = func(client precisionfda.IPFDAClient, arg *string) error {887 funcWasCalled = true888 input.Arg = arg889 input.FlagLines = -1890 return nil891 }892 893 // Case: simple mkdir894 os.Args = []string{""pfda"", ""cat"", ""testfile.txt"", ""--key"", ""AUTH_KEY""}895 returnCode := runMainInternal(false)896 test.Equals(t, 0, returnCode)897 test.Equals(t, true, funcWasCalled)898 test.Equals(t, ""testfile.txt"", *input.Arg)899 test.Equals(t, -1, input.FlagLines)900 reset()901 902}903","Go"
904"Assay","FDA/precisionFDA","packages/cli/build-dist.sh",".sh","1132","45","#!/bin/sh905#906# N.B. run from precision-fda/go907 908VERSION=2.8.0909COMMITID=`git rev-parse HEAD`910 911BuildAndPackage() {912 PLATFORM=$1913 ARCH=$2914 BUILDTIME=$(date +%Y-%m-%d-%H%M%S)915 echo ""Building pfda CLI (v$VERSION) for $PLATFORM $ARCH""916 docker run --rm --mount type=bind,source=""$(pwd)"",target=/go/src/dnanexus.com/precision-fda-cli \917 -e GOOS=""$PLATFORM"" -e GOARCH=""$ARCH"" -e COMMITID=""$COMMITID"" \918 -e VERSION=""$VERSION"" -e BUILDTIME=""$BUILDTIME"" precisionfda-cli919 cd ./dist920 921 OUT_FILE=pfda_${PLATFORM}_${ARCH}922 if [ ! -f ""$OUT_FILE"" ]; then923 echo924 echo ""$OUT_FILE does not exist. Exiting""925 exit 1926 fi927 928 EXEC_NAME=""pfda""929 if [ $PLATFORM = ""windows"" ]; then930 EXEC_NAME=""pfda.exe""931 fi932 933 mv ${OUT_FILE} ${EXEC_NAME}934 935 if [ $PLATFORM = ""windows"" ]; then936 zip -rj pfda-${PLATFORM}-${VERSION}.zip ${EXEC_NAME}937 else938 tar -czvf pfda-${PLATFORM}-${VERSION}.tar.gz ${EXEC_NAME}939 fi940 rm ${EXEC_NAME}941 942 cd ..943}944 945BuildAndPackage 'linux' 'amd64'946BuildAndPackage 'darwin' 'amd64' # N.B. darwin is macOS947BuildAndPackage 'windows' 'amd64'948","Shell"
949"Assay","FDA/precisionFDA","packages/cli/pfda.go",".go","31100","967","// PrecisionFDA CLI950// Version 2.8.0951package main952 953import (954 ""crypto/tls""955 ""encoding/json""956 ""flag""957 ""fmt""958 ""net/http""959 ""os""960 ""path/filepath""961 ""runtime""962 ""strconv""963 ""strings""964 965 _ ""crypto/tls/fipsonly""966 ""dnanexus.com/precision-fda-cli/helpers""967 ""dnanexus.com/precision-fda-cli/precisionfda""968 ""rsc.io/goversion/version""969)970 971// CONSTANTS972const defaultNumRoutines = 10973const defaultChunkSize = 1 << 26 // default 64MB (min. 16MB)974const defaultSkipVerify = ""false""975const usageString = `976****************************977PFDA COMMAND LINE TOOL v2.8.0978****************************979 980All available commands:981 pfda cat982 pfda describe983 pfda download984 pfda get-scope985 pfda head986 pfda ls987 pfda ls-apps988 pfda ls-assets989 pfda ls-discussions990 pfda ls-executions991 pfda ls-members992 pfda ls-spaces993 pfda ls-workflows994 pfda mkdir995 pfda rm996 pfda rmdir997 pfda upload-asset998 pfda upload-file999 pfda view-link1000 1001Command specific help section with description, examples and available flags:1002 pfda <COMMAND> -help1003 1004To print version info and exit:1005 pfda -version1006 1007Full documentation can be found in the Docs section of the precisionFDA website - https://precision.fda.gov/docs/cli1008`1009 1010//1011// N.B. the -cmd flag exists and is now deprecated, but the following should all work1012//1013// # Testing upload to localhost1014// $ ./pfda upload-file -server localhost:3000 -skipverify true -key $KEY -file fileYouWantToUpload.pdf1015// $ ./pfda -cmd upload-file -server localhost:3000 -skipverify true -key $KEY -file fileYouWantToUpload.pdf1016//1017// # Testing download from localhost1018// $ ./pfda download -server localhost:3000 -skipverify true -key $KEY -file file-yourfileuuid-11019// $ ./pfda -cmd download -server localhost:3000 -skipverify true -key $KEY -file file-yourfileuuid-11020//1021// # Testing the API for file download1022// $ ./pfda api -server localhost:3000 -skipverify true -key $KEY -route ""files/file-G70fbKj0qp9YGkg24kGxQvF4-1/download"" -json '{ ""format"": ""json"" }'1023// $ ./pfda -cmd api -server localhost:3000 -skipverify true -key $KEY -route ""files/file-G70fbKj0qp9YGkg24kGxQvF4-1/download"" -json '{ ""format"": ""json"" }'1024 1025// GLOBAL VARIABLES1026var defaultURL = ""precision.fda.gov""1027 1028// these varaibles are populated by -ldflags -X command line options1029var (1030 commitID string1031 Version string1032 BuildTime string1033 OsArch string1034)1035 1036// ACTION FUNCTIONS1037// Wrapping calls to pfdaclient allow us to replace these functions in pfda_test.go with mocks1038var invokeUploadFile = func(client precisionfda.IPFDAClient, inputFilePath *string, folderID *string, spaceID *string, inputChunkSize *int, inputNumRoutines *int) error {1039 client.SetChunkSize(*inputChunkSize)1040 client.SetNumRoutines(*inputNumRoutines)1041 return client.UploadFile(*inputFilePath, *folderID, *spaceID, true)1042}1043 1044var invokeUploadStdinFile = func(client precisionfda.IPFDAClient, fileName *string, folderID *string, spaceID *string, inputChunkSize *int, inputNumRoutines *int) error {1045 client.SetChunkSize(*inputChunkSize)1046 client.SetNumRoutines(*inputNumRoutines)1047 return client.UploadStdin(*fileName, *folderID, *spaceID, true)1048 1049}1050 1051var invokeUploadMultipleFiles = func(client precisionfda.IPFDAClient, filePaths *[]string, folderID *string, spaceID *string, inputChunkSize *int, inputNumRoutines *int) error {1052 client.SetChunkSize(*inputChunkSize)1053 client.SetNumRoutines(*inputNumRoutines)1054 return client.UploadMultipleFiles(*filePaths, *folderID, *spaceID)1055}1056 1057var invokeUploadFolder = func(client precisionfda.IPFDAClient, inputPath *string, folderID *string, spaceID *string, inputChunkSize *int, inputNumRoutines *int) error {1058 client.SetChunkSize(*inputChunkSize)1059 client.SetNumRoutines(*inputNumRoutines)1060 return client.UploadFolder(*inputPath, *folderID, *spaceID)1061}1062 1063var invokeUploadAsset = func(client precisionfda.IPFDAClient, assetFolderPath *string, assetName *string, readmeFilePath *string, inputChunkSize *int, inputNumRoutines *int) error {1064 client.SetChunkSize(*inputChunkSize)1065 client.SetNumRoutines(*inputNumRoutines)1066 return client.UploadAsset(*assetFolderPath, *assetName, *readmeFilePath)1067}1068 1069var invokeDownload = func(client precisionfda.IPFDAClient, args *[]string, folderID *string, spaceID *string, public bool, recursive bool, outputFilePath *string, overwriteFile *string) error {1070 return client.Download(*args, *folderID, *spaceID, public, recursive, *outputFilePath, *overwriteFile)1071}1072 1073var invokeFileViewLink = func(client precisionfda.IPFDAClient, fileID *string, preauthenticated bool, duration int64) error {1074 return client.FileViewLink(*fileID, preauthenticated, duration)1075}1076 1077var invokeUploadResources = func(client precisionfda.IPFDAClient, args *[]string, portalID *string) error {1078 return client.UploadResources(*args, *portalID)1079}1080 1081var invokeDescribe = func(client precisionfda.IPFDAClient, entityID *string) error {1082 return client.DescribeEntity(*entityID)1083}1084 1085var invokeLsSpaces = func(client precisionfda.IPFDAClient, flags map[string]bool) error {1086 return client.LsSpaces(flags)1087}1088 1089var invokeListing = func(client precisionfda.IPFDAClient, folderID *string, spaceID *string, flags map[string]bool) error {1090 return client.Ls(*folderID, *spaceID, flags)1091}1092 1093var invokeLsApps = func(client precisionfda.IPFDAClient, spaceID *string, flags map[string]bool) error {1094 return client.LsApps(*spaceID, flags)1095}1096 1097var invokeLsAssets = func(client precisionfda.IPFDAClient, spaceID *string, flags map[string]bool) error {1098 return client.LsAssets(*spaceID, flags)1099}1100 1101var invokeLsWorkflows = func(client precisionfda.IPFDAClient, spaceID *string, flags map[string]bool) error {1102 return client.LsWorkflows(*spaceID, flags)1103}1104 1105var invokeLsExecutions = func(client precisionfda.IPFDAClient, spaceID *string, flags map[string]bool) error {1106 return client.LsExecutions(*spaceID, flags)1107}1108 1109var invokeLsMembers = func(client precisionfda.IPFDAClient, spaceID *string) error {1110 return client.LsMembers(*spaceID)1111}1112 1113var invokeLsDiscussions = func(client precisionfda.IPFDAClient, spaceID *string) error {1114 return client.LsDiscussions(*spaceID, map[string]bool{})1115}1116 1117var invokeMkdir = func(client precisionfda.IPFDAClient, names *[]string, folderID *string, spaceID *string, parents bool) error {1118 return client.Mkdir(*names, *folderID, *spaceID, parents)1119}1120 1121var invokeRmdir = func(client precisionfda.IPFDAClient, args *[]string) error {1122 return client.Rmdir(*args)1123}1124 1125var invokeRm = func(client precisionfda.IPFDAClient, args *[]string, folderID *string, spaceID *string) error {1126 return client.Rm(*args, *folderID, *spaceID)1127}1128 1129var invokeHead = func(client precisionfda.IPFDAClient, arg *string, lines int) error {1130 return client.Head(*arg, lines)1131}1132 1133var invokeCat = func(client precisionfda.IPFDAClient, arg *string) error {1134 // reusing head command with unreachable limit1135 return client.Head(*arg, -1)1136}1137 1138var invokeGetScope = func(client precisionfda.IPFDAClient) error {1139 return client.GetScope()1140}1141 1142var invokeCreateDiscussion = func(client precisionfda.IPFDAClient, spaceID *string, jsonBody *string) error {1143 return client.CreateDiscussion(*spaceID, *jsonBody)1144}1145 1146var invokeCreateReply = func(client precisionfda.IPFDAClient, jsonBody *string) error {1147 return client.CreateReply(*jsonBody)1148}1149 1150var invokeEditDiscussion = func(client precisionfda.IPFDAClient, jsonBody *string) error {1151 return client.EditDiscussion(*jsonBody)1152}1153 1154var invokeEditReply = func(client precisionfda.IPFDAClient, jsonBody *string) error {1155 return client.EditReply(*jsonBody)1156}1157 1158var invokeRefreshToken = func(client precisionfda.IPFDAClient, autoRefresh bool) (string, error) {1159 return client.RefreshToken(autoRefresh)1160}1161 1162var invokeGetLatestVersion = func(client precisionfda.IPFDAClient) (string, error) {1163 return client.GetLatestVersion()1164}1165 1166func main() {1167 returnCode := mainInternal()1168 os.Exit(returnCode)1169}1170 1171func mainInternal() int {1172 // This isn't necessary for the CLI to run correctly, but we define command line flags1173 // inside mainInternal so that they can be unit tested1174 flag.CommandLine = flag.NewFlagSet(os.Args[0], flag.ExitOnError)1175 1176 command := flag.String(""cmd"", """", ""[Deprecated - please use the format ./pfda <cmd>] Command to execute."")1177 authKey := flag.String(""key"", """", ""Authorization key. Required if a previous config doesn't exist."")1178 apiRoute := flag.String(""route"", """", ""Name of precisionFDA API route to call."")1179 jsonInput := flag.String(""json-payload"", """", ""JSON payload for specified API call (if any)."")1180 inputFilePath := flag.String(""file"", """", ""Path to file for 'upload-file'"")1181 assetFolderPath := flag.String(""root"", """", ""Path to root folder for 'upload-asset'"")1182 fileName := flag.String(""name"", """", ""Name of uploaded file."")1183 readmeFilePath := flag.String(""readme"", """", ""Readme file for uploaded asset. Must end with '.txt' or '.md'."")1184 fileID := flag.String(""file-id"", """", ""File ID of the file to be downloaded"")1185 appID := flag.String(""app-id"", """", ""App ID of the app to be described"")1186 workflowID := flag.String(""workflow-id"", """", ""Workflow ID of the workflow to be described"")1187 folderID := flag.String(""folder-id"", """", ""Folder ID of the target folder"")1188 spaceID := flag.String(""space-id"", """", ""Space ID of the target space"")1189 portalID := flag.String(""portal-id"", """", ""Slug or ID of the target portal"")1190 outputFilePath := flag.String(""output"", """", ""[optional] File path to write api call response data. Defaults to stdout."")1191 inputChunkSize := flag.Int(""chunksize"", defaultChunkSize, ""[optional] Size of each upload chunk in bytes (Min 5MB,/Max 2GB)."")1192 inputNumRoutines := flag.Int(""threads"", defaultNumRoutines, ""[optional] Maximum number of upload threads to spawn (Max 100)."")1193 server := flag.String(""server"", defaultURL, ""[optional] Server to connect and make requests to."")1194 skipVerify := flag.String(""skipverify"", defaultSkipVerify, ""[optional] Boolean string to skip certificate verification."")1195 pfda_version := flag.Bool(""version"", false, ""[optional] Print version"")1196 1197 // help flag - does not run any command just prints help info1198 flagHelp := flag.Bool(""help"", false, ""[optional] Print help info for the particular command"")1199 flagHelpShort := flag.Bool(""h"", false, ""[optional] Print help info for the particular command"") // is there a better way to have aliases ??1200 