microsoft / go-sqlcmd

The new sqlcmd, CLI for SQL Server and Azure SQL (winget install sqlcmd / sqlcmd create mssql / sqlcmd open ads)
https://learn.microsoft.com/sql/tools/sqlcmd/go-sqlcmd-utility
MIT License
334 stars 58 forks source link

Cope with no HOME env var in user shell #281

Closed stuartpa closed 1 year ago

stuartpa commented 1 year ago

It's possible for the user shell to have no $HOME/%USERPROFILE% env var. This closes #279. We need to cope with this:

  1. We will use "." (current working directory), as the default dir to place the .sqlcmd/sqlconfig file in, can be overriden using --sqlconfig (when in the modern CLI)
  2. When running in legacy mode, we won't try to read the sqlconfig file if it doesn't exist in the default location (which requires the %HOME/%USERPROFILE% envvar), we also won't create an empty sqlconfig file in this case.