Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ workflow.
headless projects) ([PR #1198](https://github.com/ActiveState/cli/pull/1198))
- You can now switch between update channels
via `state update --set-channel` ([PR #1190](https://github.com/ActiveState/cli/pull/1190))
- State tool will now provide instructions on how to get out of a detached
state ([PR #1249](https://github.com/ActiveState/cli/pull/1249))
- State tool now supports branches via flags in `state activate` and
the `state branch` subcommand. See `state branch --help` for more information.

Expand Down
4 changes: 3 additions & 1 deletion cmd/state/internal/cmdtree/activate.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import (
"github.com/ActiveState/cli/pkg/project"
)

const activateCmdName = "activate"

func newActivateCommand(prime *primer.Values) *captain.Command {
runner := activate.NewActivate(prime)

Expand All @@ -23,7 +25,7 @@ func newActivateCommand(prime *primer.Values) *captain.Command {
}

cmd := captain.NewCommand(
"activate",
activateCmdName,
"",
locale.T("activate_project"),
prime.Output(),
Expand Down
18 changes: 17 additions & 1 deletion cmd/state/internal/cmdtree/cmdtree.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ import (
"github.com/ActiveState/cli/cmd/state/internal/cmdtree/intercepts/cmdcall"
"github.com/ActiveState/cli/internal/captain"
"github.com/ActiveState/cli/internal/condition"
"github.com/ActiveState/cli/internal/constants"
"github.com/ActiveState/cli/internal/locale"
"github.com/ActiveState/cli/internal/logging"
"github.com/ActiveState/cli/internal/output"
"github.com/ActiveState/cli/internal/primer"
"github.com/ActiveState/cli/internal/runners/state"
secretsapi "github.com/ActiveState/cli/pkg/platform/api/secrets"
"github.com/ActiveState/cli/pkg/project"
)

// CmdTree manages a tree of captain.Command instances.
Expand Down Expand Up @@ -266,7 +269,7 @@ func newStateCommand(globals *globalOptions, prime *primer.Values) *captain.Comm

cmdCall := cmdcall.New(prime)

cmd.SetInterceptChain(cmdCall.InterceptExec)
cmd.SetInterceptChain(cmdCall.InterceptExec, interceptAddHeadlessNotify(prime.Output(), prime.Project()))

return cmd
}
Expand Down Expand Up @@ -312,3 +315,16 @@ func (a *addCmdAs) deprecatedAlias(aliased *captain.Command, name string) {

a.parent.AddChildren(cmd)
}

func interceptAddHeadlessNotify(out output.Outputer, pj *project.Project) captain.InterceptFunc {
return func(next captain.ExecuteFunc) captain.ExecuteFunc {
return func(cmd *captain.Command, args []string) error {
if pj != nil && pj.IsHeadless() && (cmd.Group() == PackagesGroup || cmd.Name() == activateCmdName) {
out.Notice(output.Heading(locale.Tr("headless_notify_title")))
out.Notice(locale.Tr("headless_notify", pj.URL(), constants.DocumentationURLHeadless))
}

return next(cmd, args)
}
}
}
3 changes: 3 additions & 0 deletions internal/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ const PlatformSignupURL = "https://platform.activestate.com" + "/create-account"
// DocumentationURL is the url for the state tool documentation
const DocumentationURL = "http://docs.activestate.com/platform/state/"

// DocumentationURLHeadless is the documentation URL for headless state docs
const DocumentationURLHeadless = DocumentationURL + "advanced-topics/detached/"

// BugTrackerURL is the URL of our bug tracker
const BugTrackerURL = "https://github.com/ActiveState/state-tool/issues"

Expand Down
7 changes: 7 additions & 0 deletions locale/en-us.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1654,3 +1654,10 @@ err_fetch_branch:
other: "Cold not get branch [NOTICE]{{.V0}}[/RESET] for project"
err_refresh_runtime:
other: "Failed to update runtime"
headless_notify_title:
other: Detached State
headless_notify:
other: |
Any changes you make are local only and will not be saved the platform. Visit: [ACTIONABLE]{{.V0}}[/RESET] to create a platform project from this commit.

For more information, including how to merge these changes into an existing project, visit: [ACTIONABLE]{{.V1}}[/RESET].
1 change: 1 addition & 0 deletions test/integration/package_int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ func (suite *PackageIntegrationTestSuite) TestPackage_headless_operation() {

suite.Run("install (update)", func() {
cp := ts.Spawn("install", "dateparser@0.7.6")
cp.ExpectLongString("Any changes you make are local only")
cp.ExpectRe("(?:Package updated|project is currently building)", 50*time.Second)
cp.Wait()
})
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.25.1
0.26.0