question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

It’d be sweet if this library also supported default arguments. The API could look like this:

arg({
  '--help': Boolean,
  '-h': '--help',

  '--branch': String,
  '-b': '--branch',

  '--config': './config',
  '-c': '--config'
})

You could distinguish between String and a String argument with a default by doing:

if (value === String) {
  // it's a string argument
}

if (typeof value === 'string') {
  // it's a string argument with a default
}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
rauschmacommented, Jul 4, 2019

@Qix- Suggestion: add this example to the project’s readme.

1reaction
Qix-commented, Apr 26, 2019

@matthewmueller Here’s an example for a utility I am writing at the moment:

const args = arg({
	'--help': Boolean,
	'-h': '--help',

	'--out-dir': String,
	'-o': '--out-dir',

	'--numeric-bold': Boolean,
	'-B': '--numeric-bold',

	'--bold': Number,
	'-b': '--bold',

	'--normal': Number,
	'-N': '--normal',

	'--path': String,
	'-p': '--path',

	'--out-name': String,
	'-O': '--out-name'
});

const {
	'--bold': boldWeight = 700,
	'--normal': normalWeight = 400,
	'--out-name': outputName = 'fonts'
} = args;
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Optimize Cura Support Settings - All3DP
Cura offers a powerful range of settings to play with. Learn about the main Cura support settings and how to best support your...
Read more >
About the Support default triggers - Zendesk help
Default trigger best practices; Notify requester and CCs of received request; Notify requester of new proactive ticket; Notify requester and CCs ...
Read more >
Best Support Settings for Resin(SLA/DLP/LCD) 3D Printing
1. Raft is the first layer which is also called attachment layer as the primary purpose of a raft is to help with...
Read more >
How to Get the Best Support Settings For Filament 3D Printing ...
Support settings in 3D printing are used to adjust how your supports are created. This can range from where supports will be created,...
Read more >
Support settings - MakerBot Support
Instead of printing supports up in straight lines from the build ... This model has been sliced with the default tree support parameters....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found