src-cli icon indicating copy to clipboard operation
src-cli copied to clipboard

src-cli doesn't accept numeric arguments

Open dadlerj opened this issue 6 years ago • 4 comments

Running the following command:

echo 'query DependencyReferences($repoPath: String!, $commitID: String!, $filePath: String!, $mode: String!, $line: Int!, $character: Int!) {
	repository(uri: $repoPath) {
	  commit(rev: $commitID) {
		file(path: $filePath) {
		  dependencyReferences(Language: $mode, Line: $line, Character: $character) {
			repoData {
			  repos {
				id
				uri
				lastIndexedRevOrLatest {
				  oid
				}
			  }
			  repoIds
			}
		  }
		}
	  }
	}
  }
  ' | src api 'repoPath=github.com/gorilla/mux' 'commitID=cb4698366aa625048f3b815af6a0dea8aef9280a' 'mode=go' 'filePath=mux.go' 'line=23' 'char=5'

Returns:

{
  "data": {
    "repository": {
      "commit": {
        "file": {}
      }
    }
  },
  "errors": [
    {
      "message": "could not unmarshal \"23\" (string) into int32: incompatible type"
    }
  ]
}

Is there a way to specify types for args?

(not urgent, just noticed this while working on https://github.com/sourcegraph/sourcegraph/issues/11753)

dadlerj avatar Jun 08 '18 03:06 dadlerj

I agree this looks like an oversight/bug and should be possible.


One immediate workaround is to use the -vars flag to pass JSON variables. e.g.

echo ... | src api -vars '{"repoPath":"github.com/gorilla/mux", "commitID":"cb4698366aa625048f3b815af6a0dea8aef9280a", "mode":"go", "filePath":"mux.go", "line": 23, "char": 5}'

slimsag avatar Jun 08 '18 04:06 slimsag

Nice, missed that option!

dadlerj avatar Jun 08 '18 04:06 dadlerj

This issue has not had any recent activity. To keep our open issue list representative of our actual priorities, it will be closed if no further activity occurs. If this issue should stay open, simply remove the stale label. Thank you for your contributions.

stale[bot] avatar Aug 07 '18 04:08 stale[bot]

This issue has not had any recent activity. To keep our open issue list representative of our actual priorities, it will be closed if no further activity occurs. If this issue should stay open, simply remove the stale label. Thank you for your contributions.

stale[bot] avatar Oct 06 '18 16:10 stale[bot]