Skip to content
This repository was archived by the owner on Aug 22, 2023. It is now read-only.

Trim description before printing first line since there could be leading \n from multi-line template strings. #40

Merged
merged 1 commit into from
Jul 25, 2018

Conversation

indexzero
Copy link
Contributor

Apologies for not including a test, but I wasn't quite sure where to put it: here, or in @oclif/plugin-help, or maybe in example-multi-js.

Lost quite a bit of time trying to figure this one out. The symptom is mycli --help displaying nothing for a given command.

The root cause around how template strings are interpreted.

If this description has a leading \n, e.g:

GoodbyeCommand.description = `
Describe the command here
...
Extra documentation goes here
`;

Then mycli --help will display nothing for that command. By trimming off any whitespace before parsing we ensure that this "gotcha" will be avoided by folks new to the framework.

…e leading `\n` from multi-line template strings.
@salesforce-cla
Copy link

Thanks for the contribution! Before we can merge this, we need @indexzero to sign the Salesforce.com Contributor License Agreement.

@codecov
Copy link

codecov bot commented Jul 13, 2018

Codecov Report

Merging #40 into master will increase coverage by 0.11%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #40      +/-   ##
==========================================
+ Coverage   70.89%   71.01%   +0.11%     
==========================================
  Files           4        4              
  Lines         134      138       +4     
  Branches       27       27              
==========================================
+ Hits           95       98       +3     
- Misses         24       25       +1     
  Partials       15       15
Impacted Files Coverage Δ
src/command.ts 77.14% <100%> (ø) ⬆️
src/index.ts 77.27% <0%> (-0.51%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8946130...ec99aa3. Read the comment docs.

Copy link
Contributor

@jdx jdx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!!

@jdx jdx merged commit 7be154c into oclif:master Jul 25, 2018
jdx pushed a commit that referenced this pull request Jul 25, 2018
<a name="1.4.36"></a>
## [1.4.36](v1.4.35...v1.4.36) (2018-07-25)

### Bug Fixes

* Trim description before printing first line since there could be leading `\n` from multi-line template strings. ([#40](#40)) ([7be154c](7be154c))
@indexzero indexzero deleted the fix/trim-help branch July 25, 2018 18:13
@salesforce-cla
Copy link

Thanks for the contribution! Before we can merge this, we need @crobbins-godaddy to sign the Salesforce.com Contributor License Agreement.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants