Skip to content
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

Passing Arguments #27

Closed
jbkc85 opened this issue Nov 22, 2016 · 4 comments · Fixed by #28
Closed

Passing Arguments #27

jbkc85 opened this issue Nov 22, 2016 · 4 comments · Fixed by #28
Assignees

Comments

@jbkc85
Copy link

jbkc85 commented Nov 22, 2016

Hi,

I am having a few issues with passing in arguments. I am using the 'flag' package in my program and here is the help output:

[~/repositories/goprojects]$ ./bin/servServices -h
Usage of ./bin/servServices:
  -file.config string
    	Location of config.json for servServices [Default: /etc/serv/config.json]
  -port string
    	Specify port for HTTP to Listen On.  [Default: 8081] (default "8081")
  -telemetry.endpoint string
    	Path under which to expose Metrics. (default "/metrics")
  -verbose
    	Enable Verbose Output of Script. [Default: false]

Here is my realize.yaml:

settings:
  resources:
    output: outputs.log
    log: logs.log
  server:
    enable: true
    open: false
    host: localhost
    port: 5000
  config:
    flimit: 0
projects:
- name: servServices
  path: /Users/jbkc85/repositories/goprojects/src/repository.local/jbkc85/servServices
  run: true
  bin: true
  generate: false
  build: false
  fmt: true
  test: false
  params:
  - -file.config /Users/jbkc85/repositories/goprojects/src/repository.local/jbkc85/servServices/config.json
  - -verbose
  watcher:
    before: []
    after: []
    paths:
    - /
    ignore_paths:
    - vendor
    exts:
    - .go
    preview: false
  cli:
    streams: true
  file:
    streams: false
    logs: false
    errors: false

However, my output is constantly showing that the argument isn't found:

[09:05:03][SERVSERVICES] : flag provided but not defined: -file.config /Users/jbkc85/repositories/goprojects/src/repository.local/jbkc85/servServices/config.json
[09:05:03][SERVSERVICES] : Usage of /Users/jbkc85/repositories/goprojects/bin/servServices:
[09:05:03][SERVSERVICES] :   -file.config string
[09:05:03][SERVSERVICES] :     	Location of config.json for servServices (default "/etc/morenet/gomags.json")
[09:05:03][SERVSERVICES] :   -port string
[09:05:03][SERVSERVICES] :     	Specify port for HTTP to Listen On. (default "8081")
[09:05:03][SERVSERVICES] :   -telemetry.endpoint string
[09:05:03][SERVSERVICES] :     	Path under which to expose Metrics. (default "/metrics")
[09:05:03][SERVSERVICES] :   -verbose
[09:05:03][SERVSERVICES] :     	Enable Verbose Output of Script. [Default: false]
[09:05:03][SERVSERVICES] : Ended

Is there something I am doing wrong? Does Realize not support these types of flags yet?

Thanks,
Jason Cameron

@asoseil
Copy link
Contributor

asoseil commented Nov 22, 2016

This should be the same situation, isn't it?
https://github.com/tockins/realize-examples/tree/master/cli

@jbkc85
Copy link
Author

jbkc85 commented Nov 22, 2016

Ah, it does appear if you use the '=' sign it solves the issue.

- -file.config=.....

Is this an issue with the YAML syntax or how the program reads it? Just asking out of curiosity.

@asoseil
Copy link
Contributor

asoseil commented Nov 22, 2016

the issue is probably related to the os/exec library with the cli library.

@jbkc85
Copy link
Author

jbkc85 commented Nov 22, 2016

actually that makes perfect sense. I will go ahead and close the ticket, though it might be a feature request for either finding those issues and replacing them with '=' or trying to handle it in the future. Regardless, thanks for the replies!

@jbkc85 jbkc85 closed this as completed Nov 22, 2016
asoseil added a commit that referenced this issue Nov 22, 2016
@asoseil asoseil mentioned this issue Nov 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants