Skip to content

Commit

Permalink
Add early access docs for GEI-CLI (github#24592)
Browse files Browse the repository at this point in the history
  • Loading branch information
lecoursen authored Feb 2, 2022
1 parent a180195 commit 4ede312
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 8 deletions.
13 changes: 12 additions & 1 deletion components/article/ToolPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,25 @@ import { useArticleContext } from 'components/context/ArticleContext'
// Nota bene: tool === application
// Nota bene: picker === switcher

const supportedTools = ['cli', 'desktop', 'webui', 'curl', 'codespaces', 'vscode']
const supportedTools = [
'cli',
'desktop',
'webui',
'curl',
'codespaces',
'vscode',
'importer_cli',
'graphql',
]
const toolTitles = {
webui: 'Web browser',
cli: 'GitHub CLI',
curl: 'cURL',
desktop: 'Desktop',
codespaces: 'Codespaces',
vscode: 'Visual Studio Code',
importer_cli: 'GitHub Enterprise Importer CLI',
graphql: 'GraphQL API',
} as Record<string, string>

// Imperatively modify article content to show only the selected tool
Expand Down
2 changes: 1 addition & 1 deletion content/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ defaultPlatform: linux
### `defaultTool`

- Purpose: Override the initial tool selection for a page, where tool refers to the application the reader is using to work with GitHub (such as GitHub.com's web UI, the GitHub CLI, or GitHub Desktop) or the GitHub APIs (such as cURL or the GitHub CLI). For more information about the tool selector, see [Markup reference for GitHub Docs](../contributing/content-markup-reference.md#tool-tags). If this frontmatter is omitted, then the tool-specific content matching the GitHub web UI is shown by default. If a user has indicated a tool preference (by clicking on a tool tab), then the user's preference will be applied instead of the default value.
- Type: `String`, one of: `webui`, `cli`, `desktop`, `curl`, `codespaces`, `vscode`.
- Type: `String`, one of: `webui`, `cli`, `desktop`, `curl`, `codespaces`, `vscode`, `importer_cli`, `graphql`.
- Optional.

```yaml
Expand Down
18 changes: 17 additions & 1 deletion contributing/content-markup-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ You can define a default platform in the frontmatter. For more information, see

## Tool tags

We occasionally need to write documentation for different tools (GitHub UI, GitHub CLI, GitHub Desktop, cURL, Codespaces, VS Code). Each tool may require a different set of instructions. We use tool tags to demarcate information for each tool.
We occasionally need to write documentation for different tools (GitHub UI, GitHub CLI, GitHub Desktop, cURL, Codespaces, VS Code, GitHub Enterprise Importer CLI, GraphQL API). Each tool may require a different set of instructions. We use tool tags to demarcate information for each tool.

### Usage

Expand Down Expand Up @@ -156,6 +156,22 @@ These instructions are pertinent to VS Code users.
{% endvscode %}
```

```
{% importer_cli %}
These instructions are pertinent to GitHub Enterprise Importer CLI users.
{% endimporter_cli %}
```

```
{% graphql %}
These instructions are pertinent to GraphQL API users.
{% endgraphql %}
```

You can define a default tool in the frontmatter. For more information, see the [content README](../content/README.md#defaulttool).

## Reusable and variable strings of text
Expand Down
2 changes: 1 addition & 1 deletion lib/frontmatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export const schema = {
// Tool-specific content preference
defaultTool: {
type: 'string',
enum: ['webui', 'cli', 'desktop', 'curl', 'codespaces', 'vscode'],
enum: ['webui', 'cli', 'desktop', 'curl', 'codespaces', 'vscode', 'importer_cli', 'graphql'],
},
// Documentation contributed by a third party, such as a GitHub Partner
contributor: {
Expand Down
2 changes: 2 additions & 0 deletions lib/liquid-tags/extended-markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export const tags = {
curl: '',
codespaces: '',
vscode: '',
importer_cli: '',
graphql: '',
all: '',
tip: 'border rounded-1 mb-4 p-3 color-border-accent-emphasis color-bg-accent f5',
note: 'border rounded-1 mb-4 p-3 color-border-accent-emphasis color-bg-accent f5',
Expand Down
13 changes: 10 additions & 3 deletions lib/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,16 @@ class Page {
this.includesPlatformSpecificContent = this.detectedPlatforms.length > 0

// set flags for webui, cli, etc switcher element
this.detectedTools = ['cli', 'desktop', 'webui', 'curl', 'codespaces', 'vscode'].filter(
(tool) => html.includes(`extended-markdown ${tool}`) || html.includes(`tool-${tool}`)
)
this.detectedTools = [
'cli',
'desktop',
'webui',
'curl',
'codespaces',
'vscode',
`importer_cli`,
`graphql`,
].filter((tool) => html.includes(`extended-markdown ${tool}`) || html.includes(`tool-${tool}`))
this.includesToolSpecificContent = this.detectedTools.length > 0

return html
Expand Down
4 changes: 3 additions & 1 deletion lib/schema-event.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ const context = {
},
application_preference: {
type: 'string',
enum: ['webui', 'cli', 'desktop', 'curl', 'codespaces', 'vscode'],
enum: ['webui', 'cli', 'desktop', 'curl', 'codespaces', 'vscode', 'importer_cli', 'graphql'],
description: 'The application selected by the user.',
},
color_mode_preference: {
Expand Down Expand Up @@ -447,6 +447,8 @@ const preferenceSchema = {
'curl',
'codespaces',
'vscode',
'importer_cli',
'graphql',
'dark',
'light',
'auto',
Expand Down

0 comments on commit 4ede312

Please sign in to comment.