File tree Expand file tree Collapse file tree 3 files changed +50
-38
lines changed
Expand file tree Collapse file tree 3 files changed +50
-38
lines changed Original file line number Diff line number Diff line change 44package main
55
66import (
7- "os"
8-
9- "github.com/microsoft/azure-linux-dev-tools/internal/app/azldev"
10- "github.com/microsoft/azure-linux-dev-tools/internal/app/azldev/cmds/advanced"
11- "github.com/microsoft/azure-linux-dev-tools/internal/app/azldev/cmds/component"
12- "github.com/microsoft/azure-linux-dev-tools/internal/app/azldev/cmds/config"
13- "github.com/microsoft/azure-linux-dev-tools/internal/app/azldev/cmds/docs"
14- "github.com/microsoft/azure-linux-dev-tools/internal/app/azldev/cmds/image"
15- "github.com/microsoft/azure-linux-dev-tools/internal/app/azldev/cmds/project"
16- "github.com/microsoft/azure-linux-dev-tools/internal/app/azldev/cmds/version"
7+ "github.com/microsoft/azure-linux-dev-tools/pkg/app/azldev_cli"
178)
189
1910func main () {
20- // Instantiate the main CLI app instance.
21- app := InstantiateApp ()
22-
23- // Execute! We'll get back an exit code that we will exit with.
24- ret := app .Execute (os .Args [1 :])
25-
26- os .Exit (ret )
27- }
28-
29- // Constructs a new instance of the main CLI application, with all subcommands registered.
30- func InstantiateApp () * azldev.App {
31- // Instantiate the main CLI application.
32- app := azldev .NewApp (azldev .DefaultFileSystemFactory (), azldev .DefaultOSEnvFactory ())
33-
34- // Give top level command packages an opportunity to register their commands (or in some cases,
35- // request post-init callbacks).
36- advanced .OnAppInit (app )
37- component .OnAppInit (app )
38- config .OnAppInit (app )
39- docs .OnAppInit (app )
40- image .OnAppInit (app )
41- project .OnAppInit (app )
42- version .OnAppInit (app )
43-
44- return app
11+ azldev_cli .Main ()
4512}
Original file line number Diff line number Diff line change 1+ // Copyright (c) Microsoft Corporation.
2+ // Licensed under the MIT License.
3+
4+ package azldev_cli
5+
6+ import (
7+ "os"
8+
9+ "github.com/microsoft/azure-linux-dev-tools/internal/app/azldev"
10+ "github.com/microsoft/azure-linux-dev-tools/internal/app/azldev/cmds/advanced"
11+ "github.com/microsoft/azure-linux-dev-tools/internal/app/azldev/cmds/component"
12+ "github.com/microsoft/azure-linux-dev-tools/internal/app/azldev/cmds/config"
13+ "github.com/microsoft/azure-linux-dev-tools/internal/app/azldev/cmds/docs"
14+ "github.com/microsoft/azure-linux-dev-tools/internal/app/azldev/cmds/image"
15+ "github.com/microsoft/azure-linux-dev-tools/internal/app/azldev/cmds/project"
16+ "github.com/microsoft/azure-linux-dev-tools/internal/app/azldev/cmds/version"
17+ )
18+
19+ func Main () {
20+ // Instantiate the main CLI app instance.
21+ app := InstantiateApp ()
22+
23+ // Execute! We'll get back an exit code that we will exit with.
24+ ret := app .Execute (os .Args [1 :])
25+
26+ os .Exit (ret )
27+ }
28+
29+ // Constructs a new instance of the main CLI application, with all subcommands registered.
30+ func InstantiateApp () * azldev.App {
31+ // Instantiate the main CLI application.
32+ app := azldev .NewApp (azldev .DefaultFileSystemFactory (), azldev .DefaultOSEnvFactory ())
33+
34+ // Give top level command packages an opportunity to register their commands (or in some cases,
35+ // request post-init callbacks).
36+ advanced .OnAppInit (app )
37+ component .OnAppInit (app )
38+ config .OnAppInit (app )
39+ docs .OnAppInit (app )
40+ image .OnAppInit (app )
41+ project .OnAppInit (app )
42+ version .OnAppInit (app )
43+
44+ return app
45+ }
Original file line number Diff line number Diff line change 11// Copyright (c) Microsoft Corporation.
22// Licensed under the MIT License.
33
4- package main_test
4+ package azldev_cli_test
55
66import (
77 "testing"
88
9- main "github.com/microsoft/azure-linux-dev-tools/cmd/azldev "
9+ azldev_cli "github.com/microsoft/azure-linux-dev-tools/pkg/app/azldev_cli "
1010 "github.com/stretchr/testify/assert"
1111 "github.com/stretchr/testify/require"
1212)
1313
1414func TestInstantiateApp (t * testing.T ) {
15- app := main .InstantiateApp ()
15+ app := azldev_cli .InstantiateApp ()
1616 if assert .NotNil (t , app ) {
1717 topLevelCommandNames , err := app .CommandNames ()
1818 require .NoError (t , err )
You can’t perform that action at this time.
0 commit comments