Empezar
Esta página fue traducida por PageTurner AI (beta). No está respaldada oficialmente por el proyecto. ¿Encontraste un error? Reportar problema →
Obtener el código fuente
El código fuente está alojado en GitHub. Para contribuir, crea un fork que te permitirá realizar cambios en tu repositorio y luego crear una solicitud de extracción en el repositorio oficial de Oh My Posh.
Para clonar localmente tu fork de Oh My Posh, abre la terminal y reemplaza <user> con tu nombre de usuario de GitHub.
git clone git@github.com:<user>/oh-my-posh.git
Instalar dependencias
- Manual
- Winget
go
The codebase is in go, meaning we need a working go setup before we can do anything else. Have a look at the go guide to get up and running with go in no time!
Oh My Posh needs at least go 1.25.5
golangci-lint
To make sure we keep on writing quality code, golang-ci lint is used to validate the changes. Have a look at the local installation guide to make sure you can validate this yourself as well.
nodejs
The documentation is written in markdown and uses Docusaurus to generate the website. To validate your changes, you'll need to have nodejs installed so you can run the website locally.
Visual Studio Code
If you're not using Visual Studio Code yet, it's a great editor to work with go and the project has the configuration built-in. You can download it here.
The project has a winget [configuration][winget-configuration] file available to install the dependencies. Navigate to the cloned repository and use winget to install the dependencies:
winget configure .config/configuration.winget
Done! Restart the terminal and you're ready to continue below.
Configurar Visual Studio Code
El repositorio incluye una configuración predeterminada (carpeta .vscode) para Visual Studio Code:
-
golangci-lintestá configurado como linter predeterminado. -
Extensiones recomendadas para una configuración inicial fluida.
-
Configuraciones predeterminadas para ejecución y depuración.
Una vez instaladas las extensiones:
-
La depuración puede iniciarse presionando F5.
-
Todas las pruebas pueden ejecutarse usando el explorador de pruebas.
Ejecutar pruebas
El código fuente de Go se encuentra en el directorio src/, asegúrate de navegar allí antes de continuar.
Pruebas unitarias
go test -v ./...
golangci-lint
golangci-lint run
Compilar la aplicación
La forma más sencilla de validar tus cambios es escribiendo pruebas. Sin embargo, al ser una herramienta visual, también querrás verificar los cambios ejecutando el prompt en tu shell.
Si ya tienes Oh My Posh en tu PATH, deberás usarlo como parámetro de salida o asegurarte de que la carpeta $GOPATH/bin/ preceda al binario de Oh My Posh en tu PATH.
go build -o (Get-Command oh-my-posh.exe).Source
Alternativamente:
$env:PATH = "$env:GOPATH\bin;$env:PATH"
go build -o $GOPATH/bin/oh-my-posh
Ejecutar el sitio web localmente
Abre tu terminal y navega a la carpeta website del repositorio. Instala las dependencias e inicia el sitio web:
npm install
npm start
Esto iniciará un servidor local en http://localhost:3000 donde podrás ver tus cambios.
Consejos adicionales
Configurar Delve en VS Code
La configuración de Delve es restrictiva por defecto (especialmente el límite de cadenas). Puedes expandir algunos límites en VS Code (settings.json o directamente en launch.json):
"go.delveConfig": {
"dlvLoadConfig": {
"followPointers": true,
"maxVariableRecurse": 3,
"maxStringLen": 400,
"maxArrayValues": 400,
"maxStructFields": -1
},
"apiVersion": 2,
"showGlobalVariables": false
}
Siguientes pasos
¡Con todo configurado, estás listo para hacer cambios y crear tu primer PR!