Help Themes #871
Replies: 4 comments 5 replies
-
I was thiking about asking people to publish packages to npm with keywords that can be used to identify an oclif theme.
This way cli users could create and backup their theme to npm and share it with other people. Then there would be a When running When running When running |
Beta Was this translation helpful? Give feedback.
-
I prefer option 3, but with a tweak to solve
What if |
Beta Was this translation helpful? Give feedback.
-
This is what Im thinking as the output of each command in my suggestion using npm packages: Assuming that 3 packages with theme list
step 1: $ sf theme list step 2: Fetching available themes ... step 3: if there are published themes Available themes
- theme_a description
- theme_b description
- theme_c description
exit 0 step 3: when there are no published themes sorry but we could not find themes at https://npmregistry.com
exit 0 theme installInstall theme asking Users to select from a list of available themes
step 1: $ sf theme install step 2: Fetching available themes ... step 3: if there are published themes Please, pick one and press enter
- theme_a my precious theme a. allanoricil
> theme_b my precious theme b. mshanemc
- theme_c my precious theme c mdonnalley step 3: when there are no published themes sorry but we could not find themes at https://npmregistry.com
exit 0 step 4: theme was selected Installing `theme_b`...
`theme_b` downloaded
You can now set the theme using `sf theme set theme_b`
exit 0 step 4: theme failed to be downloaded Installing `theme_b`...
`theme_b` failed to be downloaded
exit 1 Install theme using its package name
step 1: $ sf theme install --name theme_c step 2: Fetching theme_c ... step 3: if theme_c exists Installing `theme_c`...
`theme_c` downloaded
You can now set the theme using `sf theme set theme_c`
exit 0 step 3: if theme_c does not exist sorry but we could not find `theme_c` at https://npmregistry.com
exit 0 Install and immediately set theme using its package name
step 1: $ sf theme install --name theme_c --set step 2: Fetching available theme_c ... step 3: if theme_c exists Installing `theme_c`...
`theme_c` downloaded
`theme_c` was set
exit 0 step 3: if theme_c does not exist sorry but we could not find `theme_c` at https://npmregistry.com
exit 0 theme setSet theme placing theme.json from the package into
step 1: $ sf theme set --name theme_c step 2: if theme_c exists in the host machine at SOMEWHERE (path were themes are saved) `theme_c` was set
exit 0 step 3: if theme_c does not exist locally `theme_c` was not found locally.
Please run `sf theme install --name theme_c` to install it
exit 0 Theme Packageproject structure .
└── my-theme/
├── theme.json
└── package.json
{
...
"keywords": [
"oclif",
"theme"
]
...
}
{
"alias" : "red",
"bin" : "rgb(255, 255, 255)",
"command" : "#45C65A",
"commandSummary" : "#FFFFFF",
"dollarSign" : "#FFFF00",
"flag" : "#45C65A",
"flagDefaultValue" : "#1AB9FF",
"flagOptions" : "#45C65A",
"flagRequired" : "#FE5C4C",
"flagSeparator" : "#FFFFFF",
"flagType" : "#0EAEE8",
"sectionDescription" : "#FFFFFF",
"sectionHeader" : "#FFFF00",
"topic" : "#45C65A",
"version" : "#45C65A"
} |
Beta Was this translation helpful? Give feedback.
-
what if we make I vote for option 3 + Shane's suggestion:
then for
use-case:I plan to have 1 light and 1 dark theme, then switch it in a script that runs automatically when switching to light/dark mode. CLIs shipping themesCLIs can ship a
Sharing oclif themesI'm not sure how many people would use this feature, let alone start publishing and maintain an npm package. if requested, we could make See also:
Footnotes
|
Beta Was this translation helpful? Give feedback.
-
#852 introduces themed help output (thanks to @AllanOricil). Users can create a theme for the help output in
~/.config/<CLI>/theme.json
In order to facilitate CLI users selecting a theme we are considering an new plugin,
@oclif/plugin-theme
, which will contain a set of commands that allow users to list, set, and unset their theme.The big outstanding question here is how this would work best for CLI developers and their users.
Option 1
themes
directory with their CLI.@oclif/plugin-theme
can read this directory to get a list of themes that the user can select from.theme set
will take a--theme
flag that corresponds to the file names found in thethemes
directory@oclif/plugin-theme
will copy the selected theme to~/.config/<CLI>/theme.json
.Pro: This option requires no modifications to the existing implementation other than creating the new plugin.
Con: Users are locked into having their theme at
~/.config/<CLI>/theme.json
Option 2
theme set
will take a--file
flag that points to any json file containing a valid themethemes
directory with their CLI and advise users that there are recommended themes there if they would like to use them.Pros: Users can point the theme to any file on their machine
Cons:
~/.config/<CLI>/theme.json
Option 3
theme set
will take a--file
flag that points to any json file containing a valid themethemes
directory with their CLI. The themes in this directory would populate the help output fortheme set
so that users are aware of the recommended themes.theme list
would also list out the recommended themesPros:
Cons:
~/.config/<CLI>/theme.json
Themed
ux
methods?Another area we'd like feedback on is whether or not the themes would be helpful outside the context of help output. For instance, themes theoretically could be applied to the
ux
methods, especiallystyledObject
,styledJSON
,table
, andtree
. Is that something worth implementing?Beta Was this translation helpful? Give feedback.
All reactions