microsoft / microsoft/terminal

Include directory flag -d in Help dialog

Open
#20,024 1 comment 0 reactions 0 assignees View on GitHub
Area-Commandline Issue-Task Product-Terminal
Dominant language
C++
Stars
105k
Forks
9.6k
Avg merge
3d 17h
Merged PRs (30d)
29

Description

### Description of the new feature

1. Include "-d PATH Specify directory to start in" in the Help dialog
2. (optional) If [SUBCOMMAND] is a path, treat that as a directory argument to start the terminal in

Backstory:
I wanted to create a terminal window from a different cli window (VSCode in this case) starting in the same path. The help dialog did not list anything close to what I wanted, so I had to ask Google (the shame). I often launch gui tools from cli with parameters relative to my present working directory.

### Proposed technical implementation details

At minimum, add the text "-d PATH Specify directory to start in" in the Help dialog somewhere in the Options section.

For the optional part:
Currently returns "[error 2147942405 (0x80070005) when launching `.']" and an otherwise stuck window.
Instead: perform a type check on the object at the path. If it's a directory, treat like a parameter to "-d" and open a window at that path. Otherwise, maintain existing behavior.
Not sure the difficulty of adding an object type check when a Subcommand is passed as a parameter. In the short term, I'm writing a PowerShell shim wt.ps1 that I'll place higher in my PATH.

Contributor guide

Open the contributing guide

Research direction

Start by locating the Help dialog's Options section and the command-line parsing entry point for the -d flag and [SUBCOMMAND]. Add the documented -d PATH text, then investigate how a path-valued subcommand is handled and verify that directory paths start the terminal there while existing non-directory behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.